简体   繁体   English

pip:从远程 git 存储库中提取更新

[英]pip: pulling updates from remote git repository

I installed scikit-learn from GitHub a couple of weeks ago:几周前我从 GitHub 安装了scikit-learn

pip install git+git://github.com/scikit-learn/scikit-learn@master

I went to GitHub and there have been several changes to the master branch since then.我去了 GitHub,从那以后主分支发生了一些变化。

How can I update my local installation of scikit-learn ?如何更新本地安装的scikit-learn

I tried pip install scikit-learn --upgrade but I got:我尝试pip install scikit-learn --upgrade但我得到了:

Requirement already up-to-date
Cleaning up ...

pip searches for the library in the Python package index. pip在 Python 包索引中搜索库。 Your version is newer than the newest one in there, so pip won't update it.您的版本比那里的最新版本新,因此 pip 不会更新它。

You'll have to reinstall from Git:您必须从 Git 重新安装:

$ pip install git+git://github.com/scikit-learn/scikit-learn@main

You need to install the version from github, or locally.您需要从 github 或本地安装该版本。

The way I usually do is that I git clone the repository locally and I run python setup.py install or python setup.py develop on it so I'm sure about the version being used.我通常做的方法是在本地 git clone 存储库,然后在其上运行python setup.py installpython setup.py develop ,因此我确定正在使用的版本。

Re-issuing the command you've done the first time with the upgrade flag would do the trick otherwise.:重新发出您第一次使用升级标志执行的命令,否则就可以解决问题。:

pip install --upgrade git+git://github.com/scikit-learn/scikit-learn@main

What worked for me was to use --force-reinstall :对我有用的是使用--force-reinstall

pip install --force-reinstall --no-deps git+git://github.com/scikit-learn/scikit-learn@main

--no-deps to avoid reinstalling all the dependencies --no-deps避免重新安装所有依赖项

IIRC, Pip installs based on pypi. IIRC,Pip基于pypi安装。 If you want to upgrade to the version that is currently hosted on github, then you are going to have to use the url from github.如果要升级到当前托管在 github 上的版本,则必须使用 github 中的 url。

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

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