7

I am trying to use different versions of Python on my Windows pc and I'm getting this error when using pip:

Fatal error in launcher: Unable to create process using '"c:\users\mypc\appdata\local\programs\python\python38\python.exe" "C:\Python38\Scripts\pip.exe" ': The system cannot find the file specified.

I understand that this might mean there's two PATH to each of those locations so it's confused, but c:\users\mypc\appdata\local\programs\python\python38\python.exe doesn't even exist on my computer nor in my PATH.

Output of where python is:

C:\Python38\python.exe`

Here is the PATH in readable format

C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\nodejs\
C:\Program Files\Git\cmd
C:\Program Files\wkhtmltopdf
C:\Program Files\Docker\Docker\resources\bin
C:\ProgramData\DockerDesktop\version-bin
C:\Python38\Scripts
C:\Python38\
"C:\Users\mypc\AppData\Local\Microsoft\WindowsApps
C:\bin"
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.2.1\bin
C:\Program Files (x86)\Nmap
C:\Users\mypc\AppData\Local\Microsoft\WindowsApps
C:\Users\mypc\AppData\Local\Programs\Microsoft VS Code\bin
C:\Users\mypc\AppData\Roaming\npm
C:\Users\mypc\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\
C:\Program Files\wkhtmltopdf
C:\ProgramData\mypc\atom\bin
C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\bin
C:\Program Files\MongoDB\Server\4.2\bin
0

2 Answers 2

24

it seems like python team may have implemented some security measures. The new method now is just to prefix python -m before your commands.

Let's say you are trying to install pygame (any package) with pip. For that, you'll use

python -m pip install pygame //Or any package name

Also, upgrading pip and all other commands will also use the same command structure:

python -m pip install --upgrade pip
Sign up to request clarification or add additional context in comments.

2 Comments

This saved me a ton of time. thanks!!! This is needed when there is global python environment variable set, and you want to access the pip inside the virtual environment which is not accessible even when you are inside /Scripts folder of Venv
This doesn't work in some circumstances. For instance, the PyInstaller package includes the pyi-grab_version.exe Script. However, invoking it directly causes the error stated in this problem. If I try to use python -m pip install pyi-grab_version.exe it just says that a module doesn't exist by that name. -- which is true bcause it came bundled with something else. What's the solution in this case?
1

When you go to Environment Variables there's 2 PATH's. One at the top and one under System variables. Deleting all references to python in the System variables PATH fixed the issue for me. You can then use pip as normal again

1 Comment

but to use python you then need it to be on your PATH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.