[英]ModuleNotFoundError: No module named 'pip' - while executing pip3
I installed pip3 using "brew install python3" on mac.我在 mac 上使用“brew install python3”安装了 pip3。
brew install python3酿造安装python3
Warning: python@3.9 3.9.2_1 is already installed and up-to-date.
To reinstall 3.9.2_1, run:
brew reinstall python@3.9
python3 --version python3--版本
returns, Python 3.8.2回报,Python 3.8.2
I dont know how to change it to point to version 3.9.2 the latest version.我不知道如何将其更改为指向最新版本 3.9.2 版本。
Now, I have the following in requirements.txt,现在,我在 requirements.txt 中有以下内容,
sklearn
pandas
pip3 install -r requirements.txt pip3 install -r requirements.txt
Gives the following error.给出以下错误。
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 6, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip'
Am new to python and not sure how to fix it.我是 python 的新手,不确定如何修复它。
Download the get-pip.py file and store it in the same directory as python is installed.下载 get-pip.py 文件并将其存储在与安装 python 相同的目录中。 or或者
Use the following command to download pip directly.使用以下命令直接下载 pip。
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Now execute the downloaded file using below command现在使用以下命令执行下载的文件
python3 get-pip.py python3 get-pip.py
Verification of the Installation process:安装过程验证:
One can easily verify if the pip has been installed correctly by performing a version check on the same.通过执行版本检查,可以轻松验证 pip 是否已正确安装。 Just go to the command line and execute the following command:只需 go 到命令行并执行以下命令:
pip3 --version pip3 --版本
For MacOS what helped me is the complete reinstallation of the python3
with brew
:对于 MacOS,帮助我的是使用brew
完全重新安装python3
:
brew uninstall python3 # if python3 worked before
brew install python3
Then the pip
started to work again as before.然后pip
开始工作了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.