python - 错误 "resolve() got an unexpected keyword argument ' Replace_conflicting'"是什么意思?

标签 python installation package pip conflict

当我使用 pip 更新 Python 安装中的某些包时,我得到了

TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'

我在某些软件包上遇到此错误,而在其他软件包上则没有,并且 have asked关于在我遇到的特定情况下解决该问题的方法(最好是在继续使用 pip 的同时);但这里的问题是错误首先意味着什么以及可能的原因是什么。

此错误意味着什么以及可能导致该错误的原因是什么?

<小时/>
Downloading/unpacking xattr
  Downloading xattr-0.7.5.tar.gz
  Running setup.py (path:/private/tmp/pip_build_root/xattr/setup.py) egg_info for package xattr
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/private/tmp/pip_build_root/xattr/setup.py", line 67, in <module>
        cmdclass={'build': cffi_build},
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 239, in __init__
        self.fetch_build_eggs(attrs.pop('setup_requires'))
      File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 264, in fetch_build_eggs
        replace_conflicting=True
    TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/private/tmp/pip_build_root/xattr/setup.py", line 67, in <module>

    cmdclass={'build': cffi_build},

  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 112, in setup

    _setup_distribution = dist = klass(attrs)

  File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 239, in __init__

    self.fetch_build_eggs(attrs.pop('setup_requires'))

  File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 264, in fetch_build_eggs

    replace_conflicting=True

TypeError: resolve() got an unexpected keyword argument 'replace_conflicting'

最佳答案

这是由于安装工具有两个不同版本造成的:一个位于 /System/Library/Frameworks/Python.framework/Versions/2.7 中,另一个位于 /Library/Python/2.7/中站 pip 包。不知何故,新版本中的 setuptools.dist.Distribution.fetch_build_eggs 会调用旧版本中的 pkg_resources.working_set.resolve 。旧版本的resolve不支持replace_conflicting参数。

在我的 OS X Lion 机器上,我能够像这样解决问题:

$ sudo python /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/easy_install.py -U setuptools
$ sudo easy_install -U pip

也就是说,我使用旧版本的easy_install来升级easy_install,然后用它来升级pip。

这解决了我系统上的问题,因为它修改了 sys.path,以便加载 /Library/Python 下的新版本 pkg_resources旧版本之前的版本仍然可以在 /System/Library/Frameworks 下找到。另一种解决方法可能是使用 PYTHONPATH 环境变量临时修改 sys.path,请参阅 the Python manual .

关于python - 错误 "resolve() got an unexpected keyword argument ' Replace_conflicting'"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22617493/

相关文章:

python - 帮助解决 Python UnboundLocalError : local variable referenced before assignment

python - 如何让 Tornado websocket 客户端接收服务器通知?

javascript - 从 JavaScript 到 Django View 的支付信息

python - 查找并删除包含特定字符串的列

linux - 将 Linux 应用程序复制到另一个 Linux 操作系统

java - Java 桌面应用程序的安装程序

.net - 安装后如何自动启动服务?

perl - 如何在定义包时获取包中的符号?

R:如何最好地将 %>% 之类的中缀运算符导入我的包中?

r - 在 R 中使用没有命名空间的包