pip is error,TypeError: __call__() takes exactly 2

2019-01-16 11:43发布

system

  • centos 7.2
  • Python 2.7.5

install

I install webhook

pip install webhook
### but hava error,then
yum install python-devel -y
## go on,pip doesn't workding
pip

error

Enter the command contain pip.Then

[root@location src]# pip
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in <module>
import packaging.requirements
File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in <module>
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)

So,what should I do?!

10条回答
地球回转人心会变
2楼-- · 2019-01-16 12:06

None of the other uninstall/reinstall/force answers worked for me, but on OS X 10.10.5 with the system Python 2.7.10, I was able to do:

pip uninstall packaging pip
easy_install pip # this installed pip 1.4.1
pip install --upgrade pip # and this upgraded to the current pip

and I was then able to import pkg_resources without a problem.

Should really learn to stop messing with the system Python…

查看更多
手持菜刀,她持情操
3楼-- · 2019-01-16 12:12

Use the following command to upgrade pip, which has the bug fixed:

python -m pip install --upgrade --force pip 

It worked for me (centos 7, python 2.7).

For more details: GitHub

查看更多
Fickle 薄情
4楼-- · 2019-01-16 12:18

I had the same problem on a fresh virtualenv and apparently this is a conflict between the version requirements for packaging, pip and pyparsing with the new setuptools. What worked for me was to pin down the old one.

pip install setuptools==33.1.1

Update:

As another answer pointed out, pip has already fixed the bug, so you should try upgrading it instead of using the workaround above.

python -m pip install --upgrade --force pip 
查看更多
太酷不给撩
5楼-- · 2019-01-16 12:20

It worked for me too (centos 7, python 2.7).

python -m pip install --upgrade --force pip 
pip install setuptools==33.1.1
查看更多
登录 后发表回答