这是一个头脑,所以我在审查并阅读了有关此问题的所有先前帖子之后发布了这个问题。
运行OSX 10.9 Python 2.7 no virtualenv
pip install awssh
Downloading/unpacking awssh
Downloading awssh-0.1.tar.gz
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/basecommand.py",
line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/commands/install.py",
line 274, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 1215, in prepare_files
req_to_install.run_egg_info()
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 288, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "/Library/Python/2.7/site-packages/pip-1.5.2-py2.7.egg/pip/req.py",
line 265, in setup_py
import setuptools
File "/Library/Python/2.7/site-packages/setuptools/__init__.py", line 11, in <module>
from setuptools.extension import Extension
File "/Library/Python/2.7/site-packages/setuptools/extension.py", line 8, in <module>
File "/Library/Python/2.7/site-packages/setuptools/dist.py", line 21, in <module>
packaging = pkg_resources.packaging
AttributeError: 'module' object has no attribute 'packaging'
答案 0 :(得分:23)
此错误是由pkg_resources
的过期版本引起的。为了消除错误,请执行以下操作:
启动python会话,导入pkg_resources
,然后查看加载它的文件:
In [1]: import pkg_resources
In [2]: pkg_resources.__file__
Out[2]: '/usr/lib/python2.7/dist-packages/pkg_resources.pyc'
删除此文件(以及关联的*.py
文件):
$ sudo rm /usr/lib/python2.7/dist-packages/pkg_resources.py*
就是这样!重新安装;它应该没有任何错误地完成:
$ sudo pip install awssh
如果您使用的是基于Debian的Linux系统,则可能已通过python-pkg-resources
软件包安装了此文件。因此,更新或重新安装此软件包将恢复过时模块!另请注意,您正在弄乱应该由apt
控制的文件。