ImportError: No module named pip when trying to in

2019-02-08 17:03发布

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

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

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

Error: Python package management tool 'pip' not found 

2条回答
放我归山
2楼-- · 2019-02-08 17:11

Download the file get-pip.py from the pip-website (http://pip.readthedocs.org/en/stable/installing/). Open the terminal, cd in to the folder where you placed get-pip.py and run:

sudo python3 get-pip.py

Open pycharm and install desired package...

查看更多
太酷不给撩
3楼-- · 2019-02-08 17:12

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/*
查看更多
登录 后发表回答