当前位置: 代码迷 >> Ruby/Rails >> solution:AttributeError: 'module' object has no attribute 'PY2'
  详细解决方案

solution:AttributeError: 'module' object has no attribute 'PY2'

热度:275   发布时间:2016-04-29 02:14:57.0
solution:AttributeError: 'module' object has no attribute 'PY2'
当我安装web.py模块(pip install web.py/ 
  sudo pip installweb.py)时出现了下面错误:
Exception:
Traceback (most recent call last):
  File"/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, inmain
    status =self.run(options, args)
  File"/usr/lib/python2.7/dist-packages/pip/commands/install.py", line278, 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, inprepare_files
   req_to_install.run_egg_info()
  File"/usr/lib/python2.7/dist-packages/pip/req.py", line 292, inrun_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, insetup_py
    ifsix.PY2 and isinstance(setup_py, six.text_type):
AttributeError: 'module' object has no attribute 'PY2'

Storing debug log for failure in /home/lzc/.pip/pip.log

解决方法:升级six,即sudo pip install --upgrade six 


If you six module has noPY2, the most likely reason is that you have anotherpackage named six somewhere. What does the following show if yourun it in the interpreter:import six; six.__file__Also, six.__version__.


>>>import six >>> six.__file__'/usr/local/lib/python2.7/dist-packages/six.pyc' >>>six.__version__ '1.3.0'


Ok, your six is very old. I doubt it's the cause, butyou could try upgrading it:pip install --upgrade six.Can't really help you further if that's not it.
  

quotefrom:http://stackoverflow.com/questions/24081043/module-object-has-no-attribute-py2
  相关解决方案