简体   繁体   English

Easy_install和pip broken:pkg_resources.DistributionNotFound:distribute == 0.6.36

[英]Easy_install and pip broke: pkg_resources.DistributionNotFound: distribute==0.6.36

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升级pip - 在OSX上升级pip,pip和easy_install都不行。

When running 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? 我怎样才能解决这个问题?

UPDATE I 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-infodistribute-0.6.49-py2.7.egg

Then the following steps fixed the issue. 然后,以下步骤解决了该问题。

  1. Changed the pip version to 1.4.1 in /usr/local/bin/pip /usr/local/bin/pip中将pip版本更改为1.4.1

  2. Changed distribute version to 0.6.49 in /usr/local/bin/easy_install /usr/local/bin/easy_install中将分发版本更改为0.6.49


The answers on other such questions to curl ez_setup.py and install setuptools from it didnt work. 关于卷曲ez_setup.py并从中安装setuptools的其他问题的答案都没有用。 It gave the following error. 它给出了以下错误。

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

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. 快乐的编码。

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. 我在/ usr / local / bin / easy_install和/usr/local/bin/easy_install-2.7上安装了额外的easy_install副本。 I am pretty sure I did so following instructions here and in other places. 我很确定我按照这里和其他地方的指示这样做了。 The solution for me was to delete these two instances: 我的解决方案是删除这两个实例:

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后才到达这一点。

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-infodistribute-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 /usr/local/bin/pip中将pip版本更改为1.4.1
  • Changed distribute version to 0.6.49 in /usr/local/bin/easy_install /usr/local/bin/easy_install中将分发版本更改为0.6.49

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,因为它似乎是您的问题。

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为我解决了这个问题!

It seems that pip was installed with reference to a new version of python, while your active python executable is still old. 似乎pip是在引用新版本的python时安装的,而你的活动python可执行文件仍然是旧的。 In case you want to keep the older version of python, it's pretty straightforward: reinstall pip using the old version. 如果你想保留版本的python,它非常简单:使用旧版本重新安装pip。

  1. Get the get-pip.py file which is linked from https://pip.pypa.io/en/stable/installing/ 获取从https://pip.pypa.io/en/stable/installing/链接的get-pip.py文件
  2. Using the old version of python executable (I assume it should be the python command), run the script. 使用旧版本的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的可执行环境。

I was in the middle of migrating from OSX system python to homebrew python, and was having the same error. 我正处于从OSX系统python迁移到homebrew python的过程中,并且遇到了同样的错误。 Upgrading the homebrew python version (running brew upgrade python ) did the thing for me. 升级自制的python版本(运行brew upgrade python )为我做了这件事。

One way to solve distributeNotFound error is to download the python module with exact version. 解决distributeNotFound错误的一种方法是下载具有精确版本的python模块。 Uncompress it, go to the folder and install it "python setup.py install". 解压缩它,转到该文件夹​​并安装它“python setup.py install”。 Then, may be upgrade it to the latest version. 然后,可能会将其升级到最新版本。

I had the error 'pkg_resources.DistributionNotFound: The 'setuptools==19.4' distribution was not found and is required by the application'. 我有错误'pkg_resources.DistributionNotFound:找不到'setuptools == 19.4'分布,并且是应用程序所需的。 I downloaded setuptools v 19.4, when v 36.2.7 is already out. 当v 36.2.7已经出来时,我下载了setuptools v 19.4。 I installed v 19.4 and then upgraded with command "easy_install --upgrade setuptools'. Everything worked like charm thereafter. 我安装了v 19.4,然后使用命令“easy_install --upgrade setuptools”进行了升级。其后一切都像魅力一样。

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

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