由于“ImportError:没有名为parse的模块”,无法安装pip

时间:2013-02-21 20:05:17

标签: python-2.7 pip

我一直在尝试为python 2.7导入pip,但似乎我缺少解析模块。我已经安装了easy_install,我正在尝试使用pip安装noise-1.1.1。但是pip不想安装。

这就是它的样子。

c:\Python27>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    from setuptools import setup
  File "c:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\__i
nit__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "c:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\ext
ension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "c:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\dis
t.py", line 6, in <module>
    from setuptools.command.install import install
  File "c:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\com
mand\__init__.py", line 8, in <module>
    from setuptools.command import install_scripts
  File "c:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\setuptools\com
mand\install_scripts.py", line 3, in <module>
    from pkg_resources import Distribution, PathMetadata, ensure_directory
  File "c:\Python27\lib\site-packages\distribute-0.6.35-py2.7.egg\pkg_resources.
py", line 17, in <module>
    from urllib.parse import urlparse, urlunparse
ImportError: No module named parse

1 个答案:

答案 0 :(得分:6)

您的distribute安装不正确;由于某种原因,python 2to3转换已在其上运行(只有在使用Python 3安装时才会自动发生)。

urllib.parse库是Python 3中用于Python 2的urlparse库的等价物。

您最好的办法是删除错误安装的版本(按照uninstallation instructions进行操作),然后再运行distribute_setup.py script