2015-03-10

pip install package 時若遇到 AttributeError: _DistInfoDistribution__dep_map

pip install package 時若遇到 AttributeError: _DistInfoDistribution__dep_map 時,那表示你的 pip 跟 setuptools 可能版本不合





Exception:
Traceback (most recent call last):
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2482, in _dep_map
    return self.__dep_map
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2344, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2473, in _parsed_pkg_info
    return self._pkg_info
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2344, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/req.py", line 1265, in prepare_files
    req_to_install.extras):
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2291, in requires
    dm = self._dep_map
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2484, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2506, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 2476, in _parsed_pkg_info
    self._pkg_info = Parser().parsestr(self.get_metadata(self.PKG_INFO))
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 1366, in get_metadata
    return self._get(self._fn(self.egg_info,name)).decode("utf-8")
  File "/usr/local/opt/pyenv/versions/3.4.2/lib/python3.4/site-packages/pip/_vendor/pkg_resources.py", line 1470, in _get

    stream = open(path, 'rb')


請試著更新 setuptools
pip install --upgrade setuptools
pip install --upgrade distribute

然後再安裝一次試試,問題應該可以解決,詳細問題原因可能出在 pip (未研究,不太確定)

沒有留言:

張貼留言