[英]ModuleNotFoundError: No module named 'pip' python3
I can't use pip and I don't know why.我不能使用 pip 我不知道为什么。 The error I get is shown below:
我得到的错误如下所示:
File "d:\python\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\Python\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
If I try py -3.8 -m pip install
I get D:\Python\python.exe: No module named pip
.如果我尝试
py -3.8 -m pip install
我得到D:\Python\python.exe: No module named pip
。
If I use get-pip nothing happens.如果我使用 get-pip 什么都不会发生。
If I try to upgrade pip nothing happens.如果我尝试升级 pip 没有任何反应。
Try尝试
python -m ensurepip
python -m ensurepip
This command activates pip.此命令激活 pip。
Ref.参考。 https://docs.python.org/3/library/ensurepip.html
https://docs.python.org/3/library/ensurepip.html
After this you can upgrade之后就可以升级了
python -m pip install --upgrade pip
python -m pip 安装--升级 pip
Try this python -m pip install --upgrade pip
试试这个
python -m pip install --upgrade pip
A suggestion, try to use anaconda or virtual env to avoid such issues.一个建议,尝试使用 anaconda 或虚拟环境来避免此类问题。
I had the same problem, but found that python -m ensurepip
just told me that the pip scripts were already installed.我有同样的问题,但发现
python -m ensurepip
刚刚告诉我 pip 脚本已经安装。 So what I did was delete the 2 pip directories under C:\Users\[user_id]\AppData\Local\Programs\Python\Python38\Lib\site-packages
, then run python -m ensurepip
again.所以我所做的是删除
C:\Users\[user_id]\AppData\Local\Programs\Python\Python38\Lib\site-packages
下的 2 个 pip 目录,然后再次运行python -m ensurepip
。 That fixed it for me.那为我修好了。
I had the same problem.我有同样的问题。 But in my case, when I was upgrading the
pip
version the new version stopped installing (upgrading) before the older version successfully uninstalled.但就我而言,当我升级
pip
版本时,新版本在旧版本成功卸载之前停止安装(升级)。 After searching 4 or 5 sites I found:在搜索了 4 或 5 个站点后,我发现:
python -m ensurepip
I was able to use the pip
command and also this:我能够使用
pip
命令以及这个:
python -m pip install --upgrade pip
For Debian/Ubuntu/Linux Mint and derivatives users对于 Debian/Ubuntu/Linux Mint 和衍生产品用户
Install pip using APT:使用 APT 安装 pip:
sudo apt install python3-pip
I don't know what OS you are using and what errors you got when using get-pip, but I had similar issue on Ubuntu20 and this solved it:我不知道您使用的是什么操作系统以及使用 get-pip 时遇到的错误,但我在 Ubuntu20 上遇到了类似的问题,这解决了它:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
Credit: @Benjamin's answer here: https://askubuntu.com/questions/1025189/pip-is-not-working-importerror-no-module-named-pip-internal信用:@Benjamin 在这里的回答: https://askubuntu.com/questions/1025189/pip-is-not-working-importerror-no-module-named-pip-internal
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.