简体   繁体   English

安装EB CLI 3.0后出现Python DistributionNotFound错误

[英]Python DistributionNotFound Error after installing EB CLI 3.0

Have tried many things, but keep getting this error after multiple attempts to update python, pip, etc. I am on OS X running 10.9.5. 尝试了很多东西,但是在多次尝试更新python,pip等之后不断出现这个错误。我在OS X上运行10.9.5。

CMD% eb 

Traceback (most recent call last):
  File "/usr/local/bin/eb", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
pkg_resources.DistributionNotFound: python-dateutil>=2.1,<3.0.0

I was experiencing a similar error when trying to run eb, though not for dateutil... 我在尝试运行eb时遇到了类似的错误,但不是因为日期...

Traceback (most recent call last):   
  File "/usr/local/bin/eb", line 5, in <module>
    from pkg_resources import load_entry_point   
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)   
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))   
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: requests>=2.6.1,<2.7

For me the solution was to update setuptools: 对我来说,解决方案是更新setuptools:

sudo pip install --upgrade setuptools

Hope that helps somebody. 希望能帮到别人。

Use the following command: 使用以下命令:

pip install awsebcli

It will automatically upgrade all dependecies of awsebcli. 它将自动升级awsebcli的所有dependecies。

use the following command 使用以下命令

sudo pip install python-dateutil

to upgrade it 升级它

Pip is probably linked to a different version of python then standard. Pip可能与标准的python的不同版本相关联。

You should try installing pip using 您应该尝试使用安装pip

python get-pip.py

(You can download get-pip.py from the pip website) (您可以从pip网站下载get-pip.py)

Otherwise, You can see which Python everything is linked too. 否则,您可以看到哪些Python也链接了。

which python

head -1 $(which eb)

head -1 $(which pip)

You can change to shebang line in the eb script to match pip and it should all work. 您可以在eb脚本中更改为shebang行以匹配pip,它应该都可以正常工作。

You can also install using a virtualenv (pythons recommended way of installing) 你也可以使用virtualenv安装(pythons推荐的安装方式)

virtualenv ~/ebenv
source ~/ebenv/bin/activate
pip install awsebcli
deactivate
sudo ln -s ~/ebenv/bin/eb /usr/local/bin/

in my case on mac osx 10.10, I had to reinstall. 在mac osx 10.10的情况下,我不得不重新安装。

sudo pip install python-dateutil

Just in case some runs into this type of error. 以防有些人遇到这种类型的错误。 check the last paragraph in the trace for the kind of error that it is being raised. 检查跟踪中的最后一段是否有引发的错误类型。 In my case, this was: 就我而言,这是:

 raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (six 1.4.1
(/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python),
Requirement.parse('six>=1.5'), set(['python-dateutil']))

I had the exact same issue, for me, the eb script was using the wrong python. 我有完全相同的问题,对我来说,eb脚本使用了错误的python。 To solve it I just modified the eb script: 为了解决这个问题,我刚刚修改了eb脚本:

> which eb
/usr/local/bin/eb
> sudo vim /usr/local/bin/eb
## Change the first line from '#!/usr/bin/python' to '#!/usr/local/bin/python'

After restarting the terminal, everything work as expected. 重新启动终端后,一切都按预期工作。

From the raised error in your log, it needs python-dateutil>=2.1 . 从日志中引发的错误,它需要python-dateutil>=2.1 So you need to make sure that version is installed and install it if not. 因此,您需要确保已安装该版本,如果没有,则安装它。 I had similar issue, and the solution (in my case) is: 我有类似的问题,解决方案(在我的情况下)是:

 $ pip install --ignore-installed python-dateutil==2.2

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

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