How can I update pip in PyCharm when I have two versions of python?

狂风中的少年 提交于 2020-08-01 05:59:22

问题


I have installed Python 2.7 and Python 3.5 on Windows 10. I use python 2.7 in my current PyCharm project and the project's python interpreter was set to python 2.7. Now I open PyCharm Settings and I want to update my pip of python 2.7.

The pip version was 8.1.1 and I clicked update, expecting it to be updated to the latest version. However, after it hinted "update successfully", I noticed that the version of pip was still 8.1.1. Then I realized that PyCharm may use my default pip version in Windows command line--which is the python3.5's pip.

How to solve this problem? Is it a bug?


回答1:


To update pip on pycharm:

  1. Open project settings (File > Settings...) (preferences on Mac)
  2. Project > Project Interpreter
  3. Press the + button
  4. Type "pip" in the top search box
  5. In the lower right corner choose "specify version"
  6. Choose your version and press Install Package

image showing the screen




回答2:


To upgrade any package to its latest version in PyCharm, the easiest way is to use Upgrade button.
When any package has newer version available, it shows in "Latest" column with horizontal blue arrow.
Any such package can be selected and click on the Vertical arrow button on right side (as you can see in below screenshot) will upgrade that package to latest version.




回答3:


No that is not a bug. It's normal behavior.

You can solve this by updating the pip in your Windows through cmd prompt.

Either by using python:

python -m pip install --upgrade pip

or easy_install:

easy_install -U pip



回答4:


In order to use the latest version of pip in newly created projects. You need to update Python where PyCharm references it (to find out this path, click Project Interpreter -> Base Interpreter in the project creation window). Then download and install or update Python to the latest version on the path specified in your IDE to the Python interpreter.




回答5:


I don't know why it's not updating pip in your machine but I just tried to update pip in my linux environment and it worked just fine.

Try this. Create a virtual environment within PyCharms with the interpreter of your choice, install all the packages you need and then try updating pip. It should work now.




回答6:


Please check where is installed your python version that are using currently and use it to run your py commands (Note that there is a Python.exe file) like that: Python installed path - windows 7

When i run this command or tried to update pip using the pycharm window nothing happend

python -m pip install --upgrade pip

change to (use all the path of the python.exe as part of the command):

C:\Users\\AppData\Local\Programs\Python\Python.exe python -m pip install --upgrade pip

You could run this command in the bottom of pycharm where is a "Terminal" option pycharm terminal option

This worked for me.



来源:https://stackoverflow.com/questions/41206850/how-can-i-update-pip-in-pycharm-when-i-have-two-versions-of-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!