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

BC9*_*BC9 10 python command-line-interface amazon-web-services python-2.7 amazon-elastic-beanstalk

尝试了很多东西,但是在多次尝试更新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
Run Code Online (Sandbox Code Playgroud)

Ben*_*ker 21

我在尝试运行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
Run Code Online (Sandbox Code Playgroud)

对我来说,解决方案是更新setuptools:

sudo pip install --upgrade setuptools
Run Code Online (Sandbox Code Playgroud)

希望能帮到别人.


Mar*_*acz 12

使用以下命令:

pip install awsebcli
Run Code Online (Sandbox Code Playgroud)

它将自动升级awsebcli的所有dependecies.


Vir*_*gar 7

使用以下命令

sudo pip install python-dateutil
Run Code Online (Sandbox Code Playgroud)

升级它


Nic*_*ich 2

Pip 可能链接到与标准版本不同的 python 版本。

您应该尝试使用安装 pip

python get-pip.py
Run Code Online (Sandbox Code Playgroud)

(可以从pip网站下载get-pip.py)

否则,您也可以看到哪个 Python 的所有内容都被链接。

which python

head -1 $(which eb)

head -1 $(which pip)
Run Code Online (Sandbox Code Playgroud)

您可以更改 eb 脚本中的 shebang 行以匹配 pip,它应该可以正常工作。

您还可以使用virtualenv(python推荐的安装方式)进行安装

virtualenv ~/ebenv
source ~/ebenv/bin/activate
pip install awsebcli
deactivate
sudo ln -s ~/ebenv/bin/eb /usr/local/bin/
Run Code Online (Sandbox Code Playgroud)