简体   繁体   English

如何将pip升级到pip3并从python 2.7切换到3

[英]How to upgrade pip to pip3 and switch from python 2.7 to 3

so I have a MacBook Air running 11.2.1 Big Sur所以我有一台运行 11.2.1 Big Sur 的 MacBook Air

pip --version

returns this output:返回这个 output:

pip 20.2.1 from /Library/Python/2.7/site-packages/pip-20.2.1-py2.7.egg/pip (python 2.7)

when I type python into the terminal, it automatically loads python 2.7, and python3 loads python 3.8.2 like its supposed to当我在终端中输入 python 时,它会自动加载 python 2.7,而 python3 会像它应该的那样加载 python 3.8.2

I want to install PyQT5 and this version of pip isn't letting me do that, I want to upgrade pip to pip3 and replace python 2 with python 3 in the process.我想安装 PyQT5 而这个版本的 pip 不允许我这样做,我想将 pip 升级到 pip3 并在此过程中将 python 2 替换为 python 3。

Can you guys help me upgrade my python and pip?你们能帮我升级我的python和pip吗? I don't mind losing python or pip 2 completely.我不介意完全丢失 python 或 pip 2。

for macOs brew install pyhton3对于 macOS brew install pyhton3

Use python3 interpreter to run the command:使用python3解释器运行命令:

python3 -m pip install --upgrade --force pip

The -m calls the __main__.py module of a specified package. -m调用指定 package 的__main__.py模块。


Use pip3 binary directly:直接使用pip3二进制文件:

pip3 install --upgrade --force pip

Valid with: pip -V适用于: pip -V

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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