I can't use pip and I don't know why. 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
.
If I use get-pip nothing happens.
If I try to upgrade pip nothing happens.
Try
python -m ensurepip
This command activates pip.
Ref. https://docs.python.org/3/library/ensurepip.html
After this you can upgrade
python -m pip install --upgrade pip
Try this python -m pip install --upgrade pip
A suggestion, try to use anaconda or virtual env to avoid such issues.
I had the same problem, but found that python -m ensurepip
just told me that the pip scripts were already installed. 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. 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. After searching 4 or 5 sites I found:
python -m ensurepip
I was able to use the pip
command and also this:
python -m pip install --upgrade pip
For Debian/Ubuntu/Linux Mint and derivatives users
Install pip using APT:
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:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.