pip 是错误,类型错误:__call__() 需要 2 个参数(给定 1 个) [英] pip is error,TypeError: __call__() takes exactly 2 arguments (1 given)

查看:22
本文介绍了pip 是错误,类型错误:__call__() 需要 2 个参数(给定 1 个)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • centos 7.2
  • Python 2.7.5

我安装了webhook

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

错误

输入包含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)

那我该怎么办?!

推荐答案

更新:

请参阅 Pedro Werneck 在此线程中较低的解决方案,而不是此解决方案.这是解决问题的正确方法.

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

前言:我不推荐这个!

这似乎有效,但我不知道后果会是什么.这是最好的货物崇拜节目!我只是在这里添加它,以防它可以帮助某些人.

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.

我对发生错误的文件 requirements.py 进行了更改.对于@hysg,就是这个文件:

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

在我的 OS X 上,它在这里:

On me on OS X, it's here:

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

我通过删除调用 MARKER_EXPR 的括号来修改有问题的行,如下所示:

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")

这奏效了.

再次强调,请小心!我不知道自己在做什么,这可能弊大于利.

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

这篇关于pip 是错误,类型错误:__call__() 需要 2 个参数(给定 1 个)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆