简体   繁体   中英

Why is PyCharm unable to find the correct verion of pip to install a Python module?

OSX: 10.9.5

PyCharm: 4.5

I am working on project in PyCharm IDE, using the 2.7.3 Python interpreter and need to import the psycopg2 module. I tried to install the module with PyCharm, but it failed and asked me to do it manually:

Image of error message

So I typed that command in the bash shell, the module installed and now it shows up in the project interpreter 2.7.2 but not in 2.7.3 !!!!!

Maybe the pip version is too old? I upgraded pip from the bash shell: pip install --upgrade pip

  • python 2.7.2 shows version 7.1.0
  • python 2.7.3 shows version 1.5.6

You should open Preferenes > Project: (projectname) > Project Interpreter .

在此处输入图片说明

Choose the interpreter you want from the dropdown. If you have installed Python with Homebrew, as I have, then you maybe want to choose one of the python interpreters from the Cellars to ease usage of other packages you may have installed with Homebrew.

You didn't specify what pip version you have. My guess is that the pip version is too old and PyCharm passing some flag which returns deprecation warning which cause it to fail. Try updating pip: pip install --upgrade pip

It might simply be that your system doesn't have pip installed, only pip3.

My system only showed me having pip3 not pip. Use which pip3 and which pip to see if you have either.

I decided to update pip3, first trying pip3 install --upgrade pip3 which, oddly, returned: ERROR: No matching distribution found for pip3

Next, I ran pip3 install --upgrade pip and now PyCharm can install packages from the GUI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM