ImportError:尝试安装软件包时没有名为pip的模块

时间:2014-03-13 21:42:41

标签: python python-2.7 python-3.x package pip

使用PyCharm重新安装Ubuntu 13.10,在设置python解释器时,我选择安装setuptools'然后安装pip'。现在,如果我尝试用pip做任何事情,我会得到以下结果:

  ciaran@ciaran-desktop:~/pycharm/bin$ pip
  Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 357, in load_entry_point
   """Does the package's distribution contain the named metadata?"""
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2394, in load_entry_point

  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2108, in load

  ImportError: No module named pip

我已经尝试过python 2.7.5和3.3.2,两者都会产生相同的结果。

编辑:以上输出来自终端。 PyCharm输出以下内容:

Error: Python package management tool 'pip' not found 

2 个答案:

答案 0 :(得分:12)

从pip-website(http://pip.readthedocs.org/en/stable/installing/)下载文件get-pip.py. 打开终端,cd进入 get-pip.py 所在的文件夹 并运行:

  

sudo python3 get-pip.py

打开pycharm并安装所需的包...

答案 1 :(得分:6)

我发现在Ubuntu上,pip并不总是为它安装的模块设置读取和执行权限。我的解决方案是始终运行此shell脚本:

sudo chmod -R a+rX /usr/lib/python*/dist-packages/
sudo chmod -R a+rX /usr/local/lib/python*/dist-packages/
sudo chmod a+rX /usr/bin/*
sudo chmod a+rX /usr/local/bin/*