简体   繁体   English

使用PIP从Github安装Python包

[英]Installing Python Package from Github Using PIP

I've seen it documented that you can install a Github hosting Python package using pip via: 我已经看到它记录了你可以使用pip via安装一个Github托管Python包:

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 (eg on Ubuntu this is /usr/local/lib/python2.6/dist-packages)? 你如何指示pip将它安装到标准的Python包目录中(例如在Ubuntu上这是/usr/local/lib/python2.6/dist-packages)?

The -e flag tells pip to install it as "editable", ie keep the source around. -e标志告诉pip将其安装为“可编辑”,即保持源代码。 Drop the -e flag and it should do about what you expect. 删除-e标志,它应该做你期望的。

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

If that doesn't work try using https instead of git. 如果这不起作用尝试使用https而不是git。

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

For Python 3 make sure you have python3-pip installed (and of course git installed): 对于Python 3,请确保安装了python3-pip(当然还安装了git):

The syntax just changed to: 语法刚刚改为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM