[英]UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 661: invalid start byte
I am trying to install the latest pip on python 2.7.2 by downloading get-pip.py from https://pip.pypa.io . 我试图通过从https://pip.pypa.io下载get-pip.py在python 2.7.2上安装最新的pip。 I run the file from windows command prompt with this statement
我使用以下语句从Windows命令提示符运行文件
c:\Python27>pip
I have also tried to follow steps from http://arunrocks.com/guide-to-install-python-or-pip-on-windows/ . 我还尝试按照http://arunrocks.com/guide-to-install-python-or-pip-on-windows/中的步骤进行操作。 But it doesn't work.
但这是行不通的。 It still give the same error traceback.
它仍然提供相同的错误回溯。
Does anyone have any tips to share? 有没有人可以分享技巧? I am using windows 7(64-bit), python 2.7.2 and EPD 7.2-2
我正在使用Windows 7(64位),python 2.7.2和EPD 7.2-2
The error traceback: 错误回溯:
Traceback (most recent call last):
File "C:\Python27\Scripts\pip-script.py", line 9, in <module>
load_entry_point('pip==8.0.2', 'console_scripts', 'pip')()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python27\lib\site-packages\pkg_resources.py", line 2279, in load_entry_point
return ep.load()
File "C:\Python27\lib\site-packages\pkg_resources.py", line 1989, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\utils\__init__.py", line 26, in <module>
from pip._vendor import pkg_resources
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 3130, in <module>
@_call_aside
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 3116, in _call_aside
f(*args, **kwargs)
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 3143, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 633, in _build_master
ws = cls()
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 626, in __init__
self.add_entry(entry)
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 682, in add_entry
for dist in find_distributions(entry, True):
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2120, in find_on_path
path_item, entry, metadata, precedence=DEVELOP_DIST
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2510, in from_location
py_version=py_version, platform=platform, **kw
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2827, in _reload_version
md_version = _version_from_file(self._get_metadata(self.PKG_INFO))
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2475, in _version_from_file
line = next(iter(version_lines), '')
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2643, in _get_metadata
for line in self.get_metadata_lines(name):
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2011, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "C:\Python27\lib\site-packages\pip-8.0.2-py2.7.egg\pip\_vendor\pkg_resources\__init__.py", line 2006, in get_metadata
metadata = f.read()
File "C:\Python27\lib\codecs.py", line 296, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 661: invalid start byte
Per the comments above, it is likely an egg-info issue with some installed library. 根据上面的评论,某些已安装的库可能是egg-info问题。
Quick way to find out which one is to edit your offending init .py and add a print statement per: 快速找出哪一个是编辑有问题的init .py并按以下方式添加打印语句:
def get_metadata(self, name):
with io.open(self.path, encoding='utf-8') as f:
if name=='PKG-INFO':
print self.path #ADD THIS
In my case (EPD python), it identified PySide-1.1.0-3.egg-info as the issue...who knows why. 就我而言(EPD python),它将PySide-1.1.0-3.egg-info识别为问题...谁知道原因。 Removing that egg-info got me past the error.
删除该egg-info使我摆脱了错误。 Long term solution is looking getting the correct or updated package.
长期解决方案是寻找正确或更新的软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.