Python 未找到“pip==7.1.0”分发版,应用程序需要此分发版
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39845636/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The 'pip==7.1.0' distribution was not found and is required by the application
提问by Arnold Laishram
I have the latest version of pip 8.1.1 on my ubuntu 16. But I am not able to install any modules via pip as I get this error all the time.
我的 ubuntu 16 上有最新版本的 pip 8.1.1。但我无法通过 pip 安装任何模块,因为我一直收到此错误。
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
@_call_aside
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 635, in _build_master
ws.require(__requires__)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 943, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 829, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==7.1.0' distribution was not found and is required by the application
I found a similar link, but not helpful.
我找到了一个类似的链接,但没有帮助。
回答by Alex Collin
I repaired mine this with command:
我用命令修复了我的这个:
easy_install pip
easy_install pip
回答by amangpt777
I had this issue for a very long time until I recently found that my 'pip' file (/usr/local/bin/pip) is trying to load the wrong version of pip. I believe you also have 8.1.1 correctly installed on your machine and can give following a try.
我有这个问题很长一段时间,直到我最近发现我的“pip”文件(/usr/local/bin/pip)试图加载错误版本的 pip。我相信您的机器上也正确安装了 8.1.1,可以尝试以下方法。
Open your /usr/local/bin/pip file. For me it looks like :
__requires__ = 'pip==9.0.1' import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.exit( load_entry_point('pip==9.0.1', 'console_scripts', 'pip')() )
Change 'pip==9.0.1' in line 1 and last line to whichever version you have installed on your system, for example you will need to change 7.1.0 to 8.1.1.
打开您的 /usr/local/bin/pip 文件。对我来说,它看起来像:
__requires__ = 'pip==9.0.1' import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.exit( load_entry_point('pip==9.0.1', 'console_scripts', 'pip')() )
将第 1 行和最后一行中的 'pip==9.0.1' 更改为您系统上安装的任何版本,例如您需要将 7.1.0 更改为 8.1.1。
Basically /usr/local/bin/pip is an entry file for loading the pip required version module. Somehow when I am upgrading/changing pip installation this file is not getting updated and so I update it manually every time.
基本上 /usr/local/bin/pip 是用于加载 pip 所需版本模块的入口文件。不知何故,当我升级/更改 pip 安装时,此文件没有更新,因此我每次都手动更新它。
回答by jarrettyeo
I did not manage to get it to work by using easy_install pip
or updating the pip configuration file /usr/local/bin/pip
.
我没有设法通过使用easy_install pip
或更新 pip 配置文件来使其工作/usr/local/bin/pip
。
Instead, I removed pip and installed the distribution required by the conf file:
相反,我删除了 pip 并安装了 conf 文件所需的发行版:
Uninstalling pip:
卸载pip:
$ sudo apt purge python-pip
or $ sudo yum remove python-pip
$ sudo apt purge python-pip
或者 $ sudo yum remove python-pip
Reinstalling required distribution of pip (change the distribution accordingly):
重新安装所需的 pip 分发(相应地更改分发):
$ sudo easy_install pip==9.0.3
$ sudo easy_install pip==9.0.3
回答by Aseem Srivastava
Delete all of the pip/pip3 stuff under .local including the packages.
删除 .local 下的所有 pip/pip3 内容,包括包。
sudo apt-get purge python-pip python3-pip
Now remove all pip3 files from local
现在从本地删除所有 pip3 文件
sudo rm -rf /usr/local/bin/pip3
you can check which pip is installed other wise execute below one to remove all (No worries)
您可以检查安装了哪个 pip 其他明智地执行下面的一个以删除所有(不用担心)
sudo rm -rf /usr/local/bin/pip3.*
Using pip and/or pip3, reinstall needed Python packages.
使用 pip 和/或 pip3,重新安装所需的 Python 包。
sudo apt-get install python-pip python3-pip
回答by sdempsey13
After upgrading from 18.0 to 18.1, I got the same error. Reinstalling the program(without using pip itself) worked for me:
从 18.0 升级到 18.1 后,我遇到了同样的错误。重新安装程序(不使用 pip 本身)对我有用:
$ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
$ sudo python get-pip.py
回答by dasons
if you have 2 versions of pip for example /usr/lib/pip
and /usr/local/lib/pip
belongs to python 2.6 and 2.7.
you can delete the /usr/lib/pip
and make a link pip=>/usr/local/lib/pip.
例如/usr/lib/pip
,如果您有 2 个版本的 pip并且/usr/local/lib/pip
属于 python 2.6 和 2.7。您可以删除/usr/lib/pip
并创建一个链接 pip=>/usr/local/lib/pip。
回答by zhi.yang
Just relink to resolve it. Find which python : ls -l /usr/local/bin/python
只需重新链接即可解决。找到哪个 python :ls -l /usr/local/bin/python
ln -sf /usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/bin/pip /usr/local/bin/pip
Or reinstall pip: https://pip.pypa.io/en/stable/installing/
或者重新安装pip:https: //pip.pypa.io/en/stable/installing/
回答by Sardorbek Imomaliev
On mac this can be fixed with brew
在 Mac 上,这可以通过 brew 修复
brew reinstall python
回答by Gane D. Geoffrey
A bit late but if easy_install doesn't solve the issue, this worked fine for me:
有点晚了,但如果 easy_install 不能解决问题,这对我来说很好用:
$ vim /usr/local/bin/pip
Then run:
然后运行:
:%s/7\.1\.0/8\.1\.1/g
:wq