setuptools出错(pkg_resources)

时间:2018-03-29 14:32:13

标签: python setuptools pkg-resources

尝试本地安装python rpm(在目录~/.local/中)

python setup.py install --user

我收到错误:

File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 701, in process_distribution
distreq.project_name, distreq.specs, requirement.extras
TypeError: __init__() takes exactly 2 arguments (4 given)

在第701行检查fileeasy_install后,我发现Requirement类产生了从pkg_resources导入的错误

我发现内部文件夹:/usr/lib/python2.7/site-packages/ 存在:

  1. /usr/lib/python2.7/site-packages/pkg_resources.py
  2. /usr/lib/python2.7/site-packages/pkg_resources/
  3. pkg_resources.py类内部要求需要4个参数

    来自

    的课程要求
    /usr/lib/python2.7/site-packages/pkg_resources/_vendor/packaging  /requirements.py
    

    需要2个参数

    我如何卸载文件夹:

    /usr/lib/python2.7/site-packages/pkg_resources/
    

    我可以删除它的内容吗?

1 个答案:

答案 0 :(得分:0)

我认为你应该升级你的setuptools:

pip install -U pip setuptools

此外,我相信您应备份并删除pkg_resources.py,我不知道该模块的来源。