您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

从特定提交进行的Pip安装会提示“已满足要求”

从特定提交进行的Pip安装会提示“已满足要求”

The reason you’re getting Requirement already satisfied is because if you do not pass --upgrade or -U (the shorthand), the package is not modified if it is already installed.

(This part of the command has had a lot of discussion. Check out the first 4 issues here)

Is there a way to upgrade only the specific packagemypackage possibily using the requirements.txt file?

You need to specify just mypackage to pip when telling it to upgrade. If you wanted to update only requests, the pip command is:

pip install --upgrade requests

Similarly, to update from your git repository, you want to do:

pip install --upgrade git+ssh://git@github.com/myuser/mypackage.git#egg=mypackage

Since it’s a URL is a long thing, what I suggest you do what @daphtdazz suggests, use multiple requirements files, as follows:

requirements.txt

requests~=2.12.3
simplejson~=3.10.0
-r git_requirements.txt

git_requirements.txt

git+ssh://git@github.com/myuser/mypackage.git#egg=mypackage

Additionally, I suggest you use shell-aliases for your shell to ease the typing load.

alias pip_git_upgrade="pip install --upgrade -r git_requirements.txt"

Do I need to specify the#egg=mypackage?

To quote from pip’s official documentation:

Any URL may use the #egg=name Syntax to explicitly state the project name.

Basically, using #egg=mypackage is a good idea since you are making the the project name explicit.

其他 2022/1/1 18:42:13 有473人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶