我尝试安装自己的python包。现在我收到了这个错误:
/usr/lib/python2.7/dist-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/__init__.pyc, but /root/PACKAGE-0.1-rc is being added to sys.path
import pkg_resources
Weard,因为我没有告诉他将这条路径添加到sys.path。 删除此文件夹后,我得到相同的错误,但路径不同
/usr/lib/python2.7/dist-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/__init__.pyc, but /usr/local/lib/python2.7/dist-packages/PACKAGE-0.1_rc-py2.7.egg is being added to sys.path
import pkg_resources
我用谷歌搜索了它,并在此处发现了一个常见的错误:Debian bug report for pkg_resources 有人重现了这个错误:
$ python
Python 2.6.6 (r266:84292, Apr 20 2011, 09:34:38)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
__main__:1: UserWarning: Module paste was already imported from None, but /usr/lib/python2.6/dist-packages is being added to sys.path
但我无法以这种方式重现它。
此错误看起来也像Stackoverflow - Module pytz was already imported。 但是我从这篇文章中找不到任何有用的信息。
/usr/local/lib/python2.7/dist-packages/PACKAGE-0.1_rc-py2.7.egg
对我来说,这是我的包所在的文件夹。
我正在使用python-setuptools 0.6.24-1。 在setuptools错误跟踪器上,它表示应该在版本0.6c10 Setuptools Bugfix
中修复此错误有人建议我摆脱这个问题吗?
答案 0 :(得分:5)
我通过使用:
将setuptools升级到2.0.2来解决这个问题sudo pip install -U setuptools