尝试安装软件包时

尝试安装软件包时

本文介绍了ImportError:尝试安装软件包时,没有名为pip的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PyCharm重新安装了Ubuntu 13.10,并在设置python解释器时选择了"install setuptools",然后选择"install pip".现在,如果我尝试对pip进行任何操作,都会得到以下信息:

Have a fresh install of Ubuntu 13.10 with PyCharm and when setting up the python interpreter I selected 'install setuptools', then 'install pip'. Now if I try and do anything with pip I get the following:

  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上进行了尝试,并且都产生了相同的结果.

I have tried on python 2.7.5 and 3.3.2 and both yield the same results.

上面的输出来自终端. PyCharm输出以下内容:

The above output is from the terminal. PyCharm outputs the following:

Error: Python package management tool 'pip' not found

推荐答案

我发现,在Ubuntu上,pip不会始终为其安装的模块设置读取和执行权限.我的解决方案是始终运行以下shell脚本:

I found that on Ubuntu, pip will not always set read and execute permissions for the modules it installs. My solution is to always run this shell script:

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/*

这篇关于ImportError:尝试安装软件包时,没有名为pip的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:45