'pip - No module named 'pip' even after successful installation
I am trying to install pip on my Windows 10 system. I got the get-pip.py file and ran the command
python get-pip.py
Here's a snapshot of the terminal
$ python get-pip.py
Collecting pip
Using cached
https://files.pythonhosted.org/packages/46/dc/7fd5df840e
fb3e56c8b4f768793a237ec4ee59891959d6a215d63f727023/pip-19.0.1-py2
.py3-none-any.whl
Collecting setuptools
Using cached
https://files.pythonhosted.org/packages/ff/47/1dfa4795e
24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-
none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-19.0.1 setuptools-40.8.0 wheel-0.32.3
Now when I try to check the version with
pip -V
I get this -
Traceback (most recent call last):
File "runpy.py", line 193, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "C:\Program Files\Python\python-3.6.3-embed-
amd64\Scripts\pip.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'
Why is this happening? It JUST said pip installed successfully and when I try to see the version to check if its installed, it says No module named 'pip'
Also, I have included C:/Program/Files/Python/python3/Scripts in the PATH variable.
Please help ! ! ! !
Solution 1:[1]
After running python get-pip.py, python install-dir will increase dir Lib\site-packages
Method 1. try to cp the pip dir into the python install-dir
or
Method 2. change file python3x._pth in python install-dir?append this line Lib\site-packages
run pip, problem will be solved
Solution 2:[2]
The following steps may be followed to install pip on windows:
- Download python file: get-pip.py (nearly 1.8 MB size) from link: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py and save it to your desktop
- Go to command prompt and Check your python version: c:> python
- From command prompt run: c:> python get-pip.py
- The above will install new version of pip. check by running C:> pip --version
- You may also update setup tools - C:> pip install --upgrade pip setuptools
Solution 3:[3]
- Open python37._pth file which is in the root folder of python.
- Add
Lib\site-packages
line.
All will work fine.
Solution 4:[4]
I suggest referring to the pip homepage: https://pip.pypa.io/en/stable/installation/ It describes all methods on how to install pip. I am a win10 user so the solution was to run this command:
py -m ensurepip --upgrade
Solution 5:[5]
Use following commands can be used to find out whether pip extraction path is included or not.
>>> import sys
>>> sys.path
if Lib\site-packages
path is not included then update file python37._pth
.
Run the command again and path should be visible.
pip install <module name>
worked successfully for me after this.
Thanks @demianzhang for the hint or even for the solution.
Solution 6:[6]
I found files in my Windows lib\site-packages directory ~ip ~ip-20-0.2.dist-info
Renamed them to pip pip-20-0.2.dist-info
And it worked to run pip install --upgrade pip
Solution 7:[7]
If your Python environment does not have pip installed, there are 2 mechanisms to install pip supported directly by pip’s maintainers:
ensurepip
get-pip.py
Method 1
ensurepip Python comes with an ensurepip module1, which can install pip in a Python environment.
Linux:
python -m ensurepip --upgrade
MacOc:
python -m ensurepip --upgrade
Windows:
py -m ensurepip --upgrade
Method 2
get-pip.py This is a Python script that uses some bootstrapping logic to install pip.
Download the script, from https://bootstrap.pypa.io/get-pip.py.
Open a terminal/command prompt, cd to the folder containing the get-pip.py file and run:
Linux:
python get-pip.py
MacOc:
python get-pip.py
Windows:
py get-pip.py
Above installation commands are in official python
link.
Optional
After successful installation of pip
you might want to upgrade pip
to latest version
for Linux and MacOs python -m pip install --upgrade pip
for Windows : py -m pip install --upgrade pip
Solution 8:[8]
py -m ensurepip --upgrade
this is work for me official docs link you can try multiple methods based on os. https://pip.pypa.io/en/stable/installation/
Solution 9:[9]
I solved my problem by opening my shell as admin
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | demianzhang |
Solution 2 | Hanumanth s |
Solution 3 | mifth |
Solution 4 | |
Solution 5 | Marcello B. |
Solution 6 | Steve Andrew |
Solution 7 | |
Solution 8 | Sumit Asagaonkar |
Solution 9 | Ed_ |