当我有两个版本的 python 时,如何在 PyCharm 中更新 pip?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41206850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I update pip in PyCharm when I have two versions of python?
提问by guo
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.
我已经在 Windows 10 上安装了 Python 2.7 和 Python 3.5。我在当前的 PyCharm 项目中使用了 python 2.7,并且该项目的 python 解释器设置为 python 2.7。现在我打开 PyCharm 设置,我想更新我的 python 2.7 pip。
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.
pip 版本是 8.1.1,我点了更新,希望能更新到最新版本。但是,在提示“更新成功”后,我注意到pip的版本仍然是8.1.1。然后我意识到 PyCharm 可能会在 Windows 命令行中使用我的默认 pip 版本——这是 python3.5 的 pip。
How to solve this problem? Is it a bug?
如何解决这个问题呢?这是一个错误吗?
回答by Billion Shiferaw
To update pip on pycharm:
要在 pycharm 上更新 pip:
- Open project settings (File > Settings...) (preferences on Mac)
- Project > Project Interpreter
- Press the + button
- Type "pip" in the top search box
- In the lower right corner choose "specify version"
- Choose your version and press Install Package
- 打开项目设置(文件 > 设置...)(Mac 上的首选项)
- 项目 > 项目口译员
- 按 + 按钮
- 在顶部搜索框中输入“pip”
- 在右下角选择“指定版本”
- 选择您的版本并按安装包
回答by Akash Dhorajiya
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.
要将任何包升级到 PyCharm 中的最新版本,最简单的方法是使用升级按钮。
当任何包有更新版本可用时,它会显示在“最新”列中,并带有水平蓝色箭头。
可以选择任何此类包,然后单击右侧的垂直箭头按钮(如下面的屏幕截图所示)将该包升级到最新版本。
回答by afxentios
No that is not a bug. It's normal behavior.
不,这不是错误。这是正常行为。
You can solve this by updating the pip in your Windows through cmd prompt
.
您可以通过更新 Windows 中的 pip 来解决此问题cmd prompt
。
Either by using python:
要么使用python:
python -m pip install --upgrade pip
or easy_install:
或easy_install:
easy_install -U pip
回答by kolserdav
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.
为了在新创建的项目中使用最新版本的 pip。您需要在 PyCharm 引用它的地方更新 Python(要查找此路径,请Project Interpreter -> Base Interpreter
在项目创建窗口中单击)。然后在 IDE 中指定的 Python 解释器路径上下载并安装 Python 或将其更新到最新版本。
回答by kingJulian
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.
我不知道为什么它没有在您的机器中更新 pip 但我只是尝试在我的 linux 环境中更新 pip 并且它工作得很好。
Try this. Create a virtual environmentwithin PyCharms with the interpreter of your choice, install all the packages you need and then try updating pip. It should work now.
尝试这个。使用您选择的解释器在 PyCharms 中创建一个虚拟环境,安装您需要的所有软件包,然后尝试更新 pip。它现在应该可以工作了。
回答by Mr. Joe
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
请检查您当前使用的 Python 版本的安装位置,并使用它来运行您的 py 命令(请注意,有一个 Python.exe 文件),例如: Python 安装路径 - Windows 7
When i run this command or tried to update pip using the pycharm window nothing happend
当我运行此命令或尝试使用 pycharm 窗口更新 pip 时,什么也没发生
python -m pip install --upgrade pip
change to (use all the path of the python.exe as part of the command):
更改为(使用 python.exe 的所有路径作为命令的一部分):
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
您可以在 pycharm 的底部运行此命令,其中“终端”选项 pycharm 终端选项
This worked for me.
这对我有用。