简体   繁体   中英

Windows 10 - python pip not working (with env vars added)

On Windows 10, with both Python 2.7 and 3.6 versions installed, and apparently all required paths added to the environment variables, pip still isn't recognised.

(Btw, when I run the python command, it shows I'm using 3.6)

My scripts folders include pip.exe, pip3.exe, pip3.6.exe.

And my environmental variables look something like this:

PATH=...;%PYTHON3%;%PYTHON2%;...

Where:
PYTHON2=C:\Python27;C:\Python27\Scripts;C:\Python27\Lib;C:\Python27\DLLs
PYTHON3=C:\Python36;C:\Python36\Scripts;C:\Python36\lib\site-packages;C:\Python36\Lib;C:\Python36\DLLs;C:\Users\Owner\AppData\Local\Programs\Python\Python36;C:\Users\Owner\AppData\Local\Programs\Python\Python36\Scripts

I've tried various permutations of the following:

pip
pip3
python3 pip
python3 pip3
py pip
py pip3

But each time I get an error message similar to the following:

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:\Python36\pip3.exe\__main__.py", line 5, in <module>
ModuleNotFoundError: No module named 'pip'

Any ideas how I can get pip working?

You are running this from python .

You need run it from CMD or Powershell

Windows logo + R

type cmd

enter

pip install <module>

Here's how I got it working.

As per the comments from eryksun, I uninstalled and re-ran the Python36 installation, and made sure to click the box to add the paths. Thereafter it worked.

For background, I believe I missed the tickbox to add the paths before. I did notice there were no pip.exe files in the Scripts folder ('perhaps' that was a result of failing to tick add paths).

And when I noticed the missing pip files, I tried a manual installation via the https://bootstrap.pypa.io/get-pip.py script. So that's how I ended up with a bunch of pip.exes, but couldn't get pip to work.

Anyway, reinstalling and ticking the add paths box worked.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM