我正在使用 ubuntu 14.04,正在尝试安装 python-memcache。我有这样的错误
Downloading/unpacking python-memcached
Downloading python-memcached-1.53.tar.gz
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 292, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 284, in setup_py
if six.PY2 and isinstance(setup_py, six.text_type):
AttributeError: 'module' object has no attribute 'PY2'
Storing debug log for failure in /home/mani/.pip/pip.log
我在安装 Django-celery、pymongo 等时遇到同样的错误
最佳答案
这个案例中的问题很简单,就是使用了一个非常旧版本的包 six
,它没有 PY2
标识符。
因为包是用 pip
安装的,所以升级它就足够了:
pip install --upgrade six
关于python - “模块”对象没有属性 'PY2',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24081043/