'模块'对象没有属性' PY2'

时间:2014-06-06 11:42:54

标签: python memcached pymongo ubuntu-14.04

我正在使用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等时出现同样的错误

1 个答案:

答案 0 :(得分:7)

在这种情况下的问题只是使用了一个非常旧版本的包six,但没有PY2标识符。

由于软件包已安装pip,因此只需使用以下命令进行升级即可:

pip install --upgrade six