solution:AttributeError: module object has no attribute PY2

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 runrequirement_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_filesreq_to_install.run_egg_info() File"/usr/lib/python2.7/dist-packages/pip/req.py", line 292, inrun_egg_infologger.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 sixIf 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:

,值不值得,真是不足为外人道,自己心里有数就行。

solution:AttributeError: module object has no attribute PY2

相关文章:

你感兴趣的文章:

标签云: