本文介绍了由于“导入错误:没有名为parse的模块",因此无法安装pip.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been trying to import pip for python 2.7 but it seems that I'm missing parse module. I already have installed easy_install, and I'm trying to install noise-1.1.1 using pip. But pip doesn't want to be installed.

这就是它的样子.

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

推荐答案

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

Your distribute installation is incorrect; for some reason the python 2to3 translation has been run on it (which only should happend automatically when installing with Python 3).

urllib.parse库与Python 2中使用的urlparse库在Python 3中等效.

The urllib.parse library is the Python 3 equivalent of the urlparse library used in Python 2.

您最好的选择是删除安装错误的版本(按照卸载说明)然后运行代替 distribute_setup.py脚本.

Your best bet is to remove the mis-installed version (follow the uninstallation instructions) then run the distribute_setup.py script instead.

这篇关于由于“导入错误:没有名为parse的模块",因此无法安装pip.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:45