首页 > 其他 > 详细

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

时间:2015-03-25 10:18:09      阅读:496      评论:0      收藏:0      [点我收藏+]
当我安装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

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

原文:http://blog.csdn.net/cleverlzc/article/details/44617441

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!