2016-02-16 106 views
0

我試圖通過從https://pip.pypa.io下載get-pip.py來安裝python 2.7.2上的最新點子。 我從Windows運行命令提示符下的文件,這種說法UnicodeDecodeError:'utf8'編解碼器無法解碼位置661中的字節0x92:無效起始字節

c:\Python27>pip 

我也試圖遵循的步驟從http://arunrocks.com/guide-to-install-python-or-pip-on-windows/。 但它不起作用。它仍然給出相同的錯誤追溯。

有沒有人有任何提示分享?我使用Windows 7(64位),蟒蛇2.7.2和EPD 7.2-2

錯誤回溯:

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 
+0

您的*系統上安裝了另一個*包,該包已損壞(非UTF8)元數據。這將是一個艱難的定位;在你的'C:\ Python27 \ lib \ site-packages'目錄下尋找'.egg-info'目錄。 –

+0

對不起,這有些不完整。會發生什麼情況是'pkg_resources'正在加載系統中所有已安裝雞蛋的元數據。其中之一包含非UTF-8編碼的元數據。它很可能是'site-packages'目錄中'.egg-info'目錄中的'PKG_INFO'文件。您可以編輯'C:\ Python27 \ lib \ site-packages \ pip-8.0.2-py2.7.egg \ pip \ _vendor \ pkg_resources \ __ init __。py'來打印正在讀取的元數據文件的文件名嘗試找到這個流氓文件。 –

+0

我編輯了這個文件,並且把打印命令放在這一行 > def get_metadata(self,name): if name =='PKG-INFO': with io.open(self.path,encoding ='utf -8')爲f: metadata = f.read() ** print(f)** 返回元數據 raise KeyError(「沒有元數據,除了PKG-INFO可用」) –

回答

-1

每上述意見,很可能一個雞蛋信息問題與一些已安裝的庫。

快速的方法來找出哪一個是編輯違規初始化的.py每添加一個print語句:

def get_metadata(self, name): 
    with io.open(self.path, encoding='utf-8') as f: 
     if name=='PKG-INFO': 
      print self.path #ADD THIS 

在我的例子(EPD蟒蛇),它確定PySide-1.1.0 -3.egg-info作爲問題......誰知道爲什麼。刪除那個蛋信息讓我超過了錯誤。長期解決方案正在尋找獲得正確或更新的軟件包。

相關問題