使用 PIP 从 Github 安装 Python 包
我已经看到它记录了您可以使用 pip 通过以下方式安装托管 Python 包的 Github:
sudo pip install -e git+git://github.com/myuser/myproject.git#egg=myproject
但是,这似乎将包安装到当前工作目录,而这几乎从来不是应该在的位置。
如何指示 pip 将其安装到标准 Python 包目录中(例如,在 Ubuntu 上,这是 /usr/local/lib/python2.6/dist-packages)?
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
-e 标志告诉 pip 将其安装为“可编辑”,即保留源代码。删除 -e 标志,它应该符合您的预期。
如果这不起作用,请尝试使用 https 而不是 git。
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.
If that doesn't work try using https instead of git.
对于 Python 3,请确保安装了 python3-pip(当然还安装了 git):
语法刚刚更改为:
For Python 3 make sure you have python3-pip installed (and of course git installed):
The syntax just changed to: