简体   繁体   English

ModuleNotFoundError:没有名为“pip”的模块 - 执行 pip3 时

[英]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.

相关问题 Pip3 和 python 不同步 | ModuleNotFoundError:没有名为“numpy”的模块` - Pip3 and python are not synchronized | ModuleNotFoundError: No module named 'numpy'` ModuleNotFoundError:没有名为“pynput”的模块 Python3 和 pip3 - ModuleNotFoundError: No module named 'pynput' Python3 and pip3 ModuleNotFoundError: 更新 pip3 后没有名为“pip._vendor.urllib3”的模块 - ModuleNotFoundError: No module named 'pip._vendor.urllib3' after update pip3 pip3 出现错误:ModuleNotFoundError: No module named 'pip._vendor.packaging.__about__' - Getting an error with pip3 : ModuleNotFoundError: No module named 'pip._vendor.packaging.__about__' ModuleNotFoundError: 没有名为“键盘”的模块,尝试安装 pip3,尝试使用 -pip list 它在那里 - ModuleNotFoundError: No module named 'keyboard, tried pip3 install, tried -pip list it is there 导入pip3会导致“导入错误:没有名为&#39;pip3&#39;的模块 - Import pip3 results in "ImportError: No module named 'pip3' ModuleNotFoundError:没有名为“rosbag”的模块,带有 pip - ModuleNotFoundError: No module named 'rosbag' with pip ModuleNotFoundError:spyder 中没有名为“pip”的模块 - ModuleNotFoundError: No module named 'pip' in spyder ModuleNotFoundError: No module named &#39;psycopg2&#39; (python3, mac, pip3 显示 psycopg2 已成功安装) - ModuleNotFoundError: No module named 'psycopg2' (python3, mac, pip3 shows psycopg2 successfully installed) ModuleNotFoundError:没有名为“bs4”的模块,但在 Python 3.8.5 上使用 PIP3 正确安装 - ModuleNotFoundError: No module named 'bs4' but installed correctly using PIP3 on Python 3.8.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM