【问题标题】:python pycparser setup errorpython pycparser设置错误
【发布时间】:2017-06-09 05:01:14
【问题描述】:

我在通过 pip 在 CentOS 7 上设置 pyparser 时看到以下错误


/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PMzCYU/pycparser/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0bpBrX-record/install-record.txt --single-version-externally-managed --compile
Traceback (most recent call last):

File "", line 1, in init.py", line 12, in import setuptools.version File "/usr/lib/python2.7/site-packages/setuptools/version.py", line 1, in import pkg_resources File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 72, in import packaging.requirements File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker") TypeError: call() takes exactly 2 arguments (1 given)

【问题讨论】:

  • 这也影响了eb deploy 最新版本的awsebcli
  • 任何分辨率?

标签: python pip centos7 pycparser


【解决方案1】:

同样的解决方案对我有用

pip install setuptools==33.1.1 然后sudo pip install -r requirements.txt

【讨论】:

    【解决方案2】:

    注意:在 Macbook Yosmite 上运行 Python 2.7.10,尝试使用 pip 安装 TensorFlow。任何安装或升级“numpy”的尝试,以解决“numpy”版本上的 TensorFlow 依赖问题,都会产生如下错误:

    TypeError: __call__() takes exactly 2 arguments (1 given)
    

    我通过 pip 安装了最新的 Tensorflow,它加载了许多包。这打破了点子。所有运行 pip 的尝试都产生了与上面帖子相同的错误,最后一行是:

    TypeError: __call__() takes exactly 2 arguments (1 given)
    

    包括上面提供的pip install setuptools==33.1.1 建议。 TensorFlow 安装了我的 pip 版本,糟糕的 pyparser 代码,看起来像。请记住,我正在运行 Python 2.7.x..

    建议pip install setuptool==33.1.1 的解决方案生成相同的错误序列,因为 Python 2.7 解析器已损坏。 pip 和 easy_install 也坏了。我什至无法使用get-pip.py 更新 pip。运行python get-pip.py 会产生与上面显示的基本相同的错误序列。真正的最大 NFG。

    [所以,解决方案...] 从其他帖子中找到解决方案:“requirements.py”(pyparser prgm?)中有错误,可以通过查找代码并编辑文件。在我的 Macbook 上,文件位于:/Library/Python/2.7/site-packages/packaging

    找到调用的python prgm:requirements.py更改第59行:

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

    收件人:

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

    我已确认此更改可让 pipeasy_install 再次运行。此外,在 Linux 上,也可以通过在 Python 中运行来引发错误:

        from pkg_resources import load_entry_point 
    

    在修复requirements.py 之后,确认现在可以在 Mac OS 10.10.5 上的 Python 2.7.10 中使用。

    【讨论】:

    • 所有基于 python2.7 的东西都破坏了我在 Mac OS 10.11 上的 macports 2.4.1 安装(我试图让 salt-cloud 运行),这修复了它。不确定这是 macports 的错误还是配置问题,但我现在可以继续生活了。
    • requirements.pypackaging 模块的一部分 - 最新版本的packagingpyparsing 已经解决了这个问题。
    【解决方案3】:

    这似乎是由 setuptools v34.0.0 中发布的https://github.com/pypa/setuptools/commit/ff371f18f0076bc63da05334f7e551c1cc29e10d 引起的。此提交删除了几个软件包的供应商。看起来这只会影响新的 setuptools 安装。现有的在 34.0.2 上都可以

    通过对版本进行硬编码来解决问题:

    pip install setuptools==33.1.1

    仍在研究如何在安装 >= 34.0.0 后修复 pip 使用情况,

    编辑:这是设计使然 “一般情况下,Setuptools 不再支持自行升级或安装。” http://setuptools.readthedocs.io/en/latest/history.html#v34-0-0

    【讨论】:

    • packagingpyparsing 模块的最新版本已经解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 2017-01-22
    • 1970-01-01
    • 2018-08-14
    • 2019-07-10
    • 1970-01-01
    • 2016-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多