Python DistributionNotFound Error after installing

2019-02-16 15:53发布

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.

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

7条回答
祖国的老花朵
2楼-- · 2019-02-16 16:17

in my case on mac osx 10.10, I had to reinstall.

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
3楼-- · 2019-02-16 16:25

use the following command

sudo pip install python-dateutil

to upgrade it

查看更多
在下西门庆
4楼-- · 2019-02-16 16:25

From the raised error in your log, it needs 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
查看更多
我想做一个坏孩纸
5楼-- · 2019-02-16 16:30

I had the exact same issue, for me, the eb script was using the wrong python. To solve it I just modified the eb script:

> 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.

查看更多
欢心
6楼-- · 2019-02-16 16:33

Pip is probably linked to a different version of python then standard.

You should try installing pip using

python get-pip.py

(You can download get-pip.py from the pip website)

Otherwise, You can see which Python everything is linked too.

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.

You can also install using a virtualenv (pythons recommended way of installing)

virtualenv ~/ebenv
source ~/ebenv/bin/activate
pip install awsebcli
deactivate
sudo ln -s ~/ebenv/bin/eb /usr/local/bin/
查看更多
小情绪 Triste *
7楼-- · 2019-02-16 16:38

I was experiencing a similar error when trying to run eb, though not for dateutil...

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:

sudo pip install --upgrade setuptools

Hope that helps somebody.

查看更多
登录 后发表回答