Python Easy_install 和 pip 坏了:pkg_resources.DistributionNotFound:distribute==0.6.36
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19400370/
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
Easy_install and pip broke: pkg_resources.DistributionNotFound: distribute==0.6.36
提问by shshank
I was tried to upgrade pip with pip install --upgrade pip
on OSX and pip and easy_install both dont work.
我试图pip install --upgrade pip
在 OSX上升级 pip,但pip 和 easy_install 都不起作用。
When running pip
运行 pip 时
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
parse_requirements(__requires__), Environment()
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.3.1
When running easy_install
运行 easy_install 时
File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2881, in <module>
parse_requirements(__requires__), Environment()
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.36
How can I fix this?
我怎样才能解决这个问题?
UPDATEI found the solution.
更新我找到了解决方案。
I did cd /usr/local/lib/python2.7/site-packages && ls
我做了 cd /usr/local/lib/python2.7/site-packages && ls
found pip-1.4.1-py2.7.egg-info
and distribute-0.6.49-py2.7.egg
in the directory.
找到pip-1.4.1-py2.7.egg-info
并distribute-0.6.49-py2.7.egg
在目录中。
Then the following steps fixed the issue.
然后以下步骤解决了这个问题。
Changed the pip version to 1.4.1 in
/usr/local/bin/pip
Changed distribute version to 0.6.49 in
/usr/local/bin/easy_install
将 pip 版本更改为 1.4.1 in
/usr/local/bin/pip
将分发版本更改为 0.6.49
/usr/local/bin/easy_install
The answers on other such questions to curl ez_setup.py and install setuptools from it didnt work. It gave the following error.
curl ez_setup.py 并从中安装 setuptools 的其他此类问题的答案不起作用。它给出了以下错误。
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.6.tar.gz
Traceback (most recent call last):
File "<stdin>", line 370, in <module>
File "<stdin>", line 366, in main
File "<stdin>", line 278, in download_setuptools
File "<stdin>", line 185, in download_file_curl
File "/usr/local/Cellar/python/2.7.4/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 542, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['curl', 'https://pypi.python.org/packages/source/s/setuptools/setuptools-1.1.6.tar.gz', '--silent', '--output', '/usr/bin/setuptools-1.1.6.tar.gz']' returned non-zero exit status 23
采纳答案by Ankur_Jatt
If you do this then it will work:
如果你这样做,那么它会起作用:
cd /usr/local/lib/python2.7/site-packages && ls
Find pip-1.4.1-py2.7.egg-info
and distribute-0.6.49-py2.7.egg
in the directory.
在目录中查找pip-1.4.1-py2.7.egg-info
和distribute-0.6.49-py2.7.egg
。
Then the following steps fixed the issue:
然后以下步骤解决了这个问题:
- Changed the pip version to 1.4.1 in
/usr/local/bin/pip
- Changed distribute version to 0.6.49 in
/usr/local/bin/easy_install
- 将 pip 版本更改为 1.4.1 in
/usr/local/bin/pip
- 将分发版本更改为 0.6.49
/usr/local/bin/easy_install
回答by AlvaroAV
Wich operative system ?
哪个操作系统?
Anyways you should try to do this:
无论如何,你应该尝试这样做:
sudo easy_install -U distribute
Maybe this is helpfull too, whit this you install easy_install-2.7:
也许这也很有帮助,安装easy_install-2.7:
wget --no-check-certificate http://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz
tar xf distribute-0.6.35.tar.gz
cd distribute-0.6.35
python2.7 setup.py install
Maybe you need to force an update, or reinstall easy_install, because it seems is your problem.
也许您需要强制更新或重新安装easy_install,因为这似乎是您的问题。
回答by ajknzhol
Install the distribute package as follows:
安装分发包如下:
$ wget https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
$ python distribute_setup.py
You will have a working easy_install
then.
easy_install
那时你会有一个工作。
Happy Coding.
快乐编码。
回答by ryechus
None of the other answers worked for me. It was much simpler with these instructions. I had installed an extra copy of easy_install at /usr/local/bin/easy_install and /usr/local/bin/easy_install-2.7. I am pretty sure I did so following instructions here and in other places. The solution for me was to delete these two instances:
其他答案都不适合我。有了这些说明,事情就简单多了。我在 /usr/local/bin/easy_install 和 /usr/local/bin/easy_install-2.7 安装了一个额外的 easy_install 副本。我很确定我是按照这里和其他地方的说明这样做的。我的解决方案是删除这两个实例:
rm /usr/local/bin/easy_install
rm /usr/local/bin/easy_install-2.7
and then reinstall pip with
然后重新安装pip
sudo easy_install --upgrade pip
Some background: I got to this point after having to reinstall OSX.
一些背景:我在不得不重新安装 OSX 后达到了这一点。
回答by questionaire
Just Pointing it out here once again to make the solution more obvious!
在这里再次指出它以使解决方案更加明显!
Just running the command sudo easy_install --upgrade pip
solved the issue for me!
只需运行命令即可sudo easy_install --upgrade pip
为我解决问题!
回答by Vinicius Zani
It seems that pip was installed with reference to a new version of python, while your active python executable is still old. In case you want to keep the olderversion of python, it's pretty straightforward: reinstall pip using the old version.
似乎 pip 是参考新版本的 python 安装的,而您的活动 python 可执行文件仍然很旧。如果您想保留旧版本的 python,非常简单:使用旧版本重新安装 pip。
- Get the
get-pip.py
file which is linked from https://pip.pypa.io/en/stable/installing/ - Using the old version of python executable (I assume it should be the
python
command), run the script.
- 获取
get-pip.py
从https://pip.pypa.io/en/stable/installing/链接的文件 - 使用旧版本的 python 可执行文件(我假设它应该是
python
命令),运行脚本。
If you're looking for a shortcut: cd /tmp/ && wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
如果您正在寻找捷径: cd /tmp/ && wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
The script removes old versions of pip and properly installs a new executable, linking to the old python's executable environment.
该脚本删除旧版本的 pip 并正确安装新的可执行文件,链接到旧 python 的可执行环境。
回答by Ryo
I was in the middle of migrating from OSX system python to homebrew python, and was having the same error.
Upgrading the homebrew python version (running brew upgrade python
) did the thing for me.
我正在从 OSX 系统 python 迁移到 homebrew python,并且遇到了同样的错误。升级自制的 python 版本(运行brew upgrade python
)对我来说是件好事。
回答by Ram
One way to solve distributeNotFound error is to download the python module with exact version. Uncompress it, go to the folder and install it "python setup.py install". Then, may be upgrade it to the latest version.
解决distributedNotFound 错误的一种方法是下载具有确切版本的python 模块。解压,进入文件夹并安装“python setup.py install”。然后,可以将其升级到最新版本。
I had the error 'pkg_resources.DistributionNotFound: The 'setuptools==19.4' distribution was not found and is required by the application'. I downloaded setuptools v 19.4, when v 36.2.7 is already out. I installed v 19.4 and then upgraded with command "easy_install --upgrade setuptools'. Everything worked like charm thereafter.
我有错误“pkg_resources.DistributionNotFound:未找到“setuptools==19.4”发行版,并且是应用程序所要求的“。我下载了 setuptools v 19.4,当时 v 36.2.7 已经出来了。我安装了 v 19.4,然后使用命令“easy_install --upgrade setuptools”升级。此后一切都像魅力一样。