Search code examples
pythonsite-packages

Python.exe in incorrect path despite adding path to Windows


I added the following python paths to the Path in Windows for system variables.

C:\Project1\python\Python310-32\Scripts
C:\Project1\python\Python310-32

When I run pip upgrade I get the following error:

Unable to create process using '"C:\Project0\python\Python310-32\python.exe"  "C:\Project1\python\Python310-32\Scripts\pip.exe" upgrade': The system cannot find the file specified.

My question is despite me adding the path to the system variables, restarting the computer multiple times, why is my python.exe still pointed to an old project in project0 instead of project 1.

I am trying to install/get a particular package under site-packages to install/work for my project. But that particular library under site-packages isn't being found.


Solution

  • Found the solution:

    Update the 'PATH' environment variable to include:

    C:\<path>\python\Python310-32\Scripts\;
    C:\<path>\python\Python310-32\
    

    Update or create 'PYTHONHOME' environment variable to include:

    C:\<path>\python\Python310-32\
    

    Update or create 'PYTHONPATH' environment variable to include:

    C:\<path>\python\Python310-32\Scripts\;
    C:\<path>\python\Python310-32\