简体   繁体   English

setuptools中的错误(pkg_resources)

[英]Error from setuptools (pkg_resources)

While trying to local install a python rpm (in directory ~/.local/ ) 在尝试本地安装python rpm时(在~/.local/目录中)

with python setup.py install --user 使用python setup.py install --user

I get the error: 我得到错误:

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)

After checking fileeasy_install in line 701, I found out that Requirement class produced the error which is imported from pkg_resources 在第701行中检查fileeasy_install之后,我发现Requirement类产生了错误,该错误是从pkg_resources导入的

I found out that inside folder: /usr/lib/python2.7/site-packages/ there exist: 我发现里面的文件夹: /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/

Inside pkg_resources.py class Requirement takes 4 arguments 在pkg_resources.py类内部,需求包含4个参数

while class Requirement from 而来自的课程要求

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

takes 2 arguments 需要2个参数

How may I uninstall folder: 我如何卸载文件夹:

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

May I just delete its contents? 我可以删除它的内容吗?

I think you should upgrade your setuptools: 我认为您应该升级您的setuptools:

pip install -U pip setuptools

Also I believe you should backup and remove pkg_resources.py , I don't know where the module comes from. 另外,我认为您应该备份并删除pkg_resources.py ,但我不知道模块的来源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM