Installing Python Package from Github Using PIP

为君一笑 提交于 2021-02-06 10:11:55

问题


I've seen it documented that you can install a Github hosting Python package using pip via:

sudo pip install -e git+git://github.com/myuser/myproject.git#egg=myproject

However, this appears to install the package to the current working directory, which is almost never where is should be.

How do you instruct pip to install it into the standard Python package directory (e.g. on Ubuntu this is /usr/local/lib/python2.6/dist-packages)?


回答1:


The -e flag tells pip to install it as "editable", i.e. keep the source around. Drop the -e flag and it should do about what you expect.

sudo pip install git+git://github.com/myuser/myproject.git#egg=myproject

If that doesn't work try using https instead of git.

sudo pip install git+https://github.com/myuser/myproject.git#egg=myproject



回答2:


For Python 3 make sure you have python3-pip installed (and of course git installed):

The syntax just changed to:

sudo pip3 install git+git://github.com/someuser/someproject.git


来源:https://stackoverflow.com/questions/9402035/installing-python-package-from-github-using-pip

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!