Why am I getting ImportError: No module named pip

2020-01-30 06:57发布

问题:

I have installed pip and ez setup. I also checked the system path and I can see the module in the folder structure. Still when i try to run pip command, I get an Import error saying no module named pip. I am running 32bit python on a windows7 machine

回答1:

Just be sure that you have include python to windows PATH variable, then run python -m ensurepip



回答2:

try to type pip3 instead pip. also for upgrading pip dont use pip3 in the command

python -m pip install -U pip

maybe it helps



回答3:

What solved the issue on my case was go to:

cd C:\Program Files\Python37\Scripts

And run below command:

easy_install.exe pip


回答4:

Follow steps given in https://michlstechblog.info/blog/python-install-python-with-pip-on-windows-by-the-embeddable-zip-file/

  1. bypassing pythonxx.__pth thru renaming
  2. adding following in to Environment variables
D:\Pythonx.x.x 
D:\Python3.6.5\DLLs
D:\Pythonx.x.x\lib
D:\Pythonx.x.x\lib\plat-win 
D:\Pythonx.x.x\lib\site-packages


回答5:

The ensurepip module was added in version 3.4 and then backported to 2.7.9.

So make sure your Python version is at least 2.7.9 if using Python 2, and at least 3.4 if using Python 3.



回答6:

turned out i had 2 versions of python on my laptop

both commands worked for me

python -m ensurepip
py -m ensurepip

both with another installation path

c:\tools\python\lib\site-packages
c:\program files (x86)\microsoft visual studio\shared\python36_64\lib\site-packages 

only the first path was in my %PATH% variable



回答7:

I'v solved this error by setting the correct path variables

    C:\Users\name\AppData\Local\Programs\Python\Python37\Scripts
    C:\Users\name\AppData\Local\Programs\Python\Python37\Lib\site-packages


回答8:

I was facing same issue and resolved using following steps

1) Go to your paython package and rename "python37._pth" to python37._pth.save

2) curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

3) then run python get-pip.py

4) pip install django

Hope this help



回答9:

If you want to run pip on windows you must go from command line to the next folder:

cd C:\Python34\Scripts

and run command there or use next source to install pip: https://pip.pypa.io/en/latest/installing/



回答10:

I've solved this error downloading the executable file for python 3.7. I've had downloaded the embeddeable version and got that error. Now it works! :D