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 11:56

This is what worked for me:

pip install setuptools==33.1.1

It downgraded setuptools from 35.0.1 to 33.1.1 and pyparsing 1.5.7 installed!

查看更多
闹够了就滚
3楼-- · 2019-01-16 11:57

UPDATE:

Please see the solution lower in this thread by Pedro Werneck instead of this one. It's the correct way to solve the problem.


Preface: I do not recommend this!

This seems to work, but I have no idea what the consequences could be. This is cargo cult programming at its best! I'm only adding it here in case it can help someone in a bind.

I made changes to the file requirements.py where the error occurred. For @hysg, that would be this file:

/usr/lib/python2.7/site-packages/packaging/requirements.py

On me on OS X, it's here:

/Library/Python/2.7/site-packages/packaging/requirements.py

I modified the the offending line by removing the parentheses for the call to MARKER_EXPR, as demonstrated below:

#MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
MARKER_EXPR = originalTextFor(MARKER_EXPR)("marker")

And that worked.

Again, please be careful! I don't know what I'm doing and this could potentially cause more harm than good.

查看更多
唯我独甜
4楼-- · 2019-01-16 11:57

I applied the fix

pip install setuptools==33.1.1

and it solved the problem for OSX 10.10.5 (Yosemite)

查看更多
\"骚年 ilove
5楼-- · 2019-01-16 11:57

Actually, I had a problem that OS/system which means root, not sudo, has been the owner of the pip2 package. But after I had executed this command:

sudo apt-get remove python-pip

it worked like a charm.
Noting, of course that I have a debian distribution.

And then I used what Pedro suggested:

sudo pip install setuptools==33.1.1
查看更多
走好不送
6楼-- · 2019-01-16 12:01

this is work well:

python -m pip install --upgrade --force pip 
pip install setuptools==33.1.1
查看更多
7楼-- · 2019-01-16 12:06

I ran into the same problem on a new virtualenv trying to install. I'm running python 2.7.11 and found the two commands belows solve the versioning problem with setuptools:

This forces a pip upgrade, which has a fix for the bug, but doesn't reinstall setup tools, so I was still running on setuptools version 35.0.1

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

This sets setuptools to an older version.

pip install setuptools==33.1.1

After this, I successfully installed my requirements.

查看更多
登录 后发表回答