[Python] How to change the launcher directory of PyTest

Discussão em 'Python' iniciado por Stack, Julho 4, 2025.

  1. Stack

    Stack Membro Participativo

    I am new to Pytest and Python. I tried to run some test with Pytest but I got this error:

    OS: Windows 11 Home

    Python version:3.13.5

    Pytest version:8.4.1

    The command I tried to run is

    PS C:\Users\xxxx\Documents\Study\LinkedIn> pytest

    Error I got:

    Fatal error in launcher: Unable to create process using '"C:\Program Files\python.exe" "C:\Users\xxxx\AppData\Roaming\Python\Python313\Scripts\pytest.exe" ': The system cannot find the file specified.

    My Python is installed under this location: C:\Users\xxxx\AppData\Local\Programs\Python\Python313

    My Pytest is installed under this location: C:\Users\xxxx\AppData\Roaming\Python\Python313\Scripts

    I've already checked my environment variables. Both folders are in the PATH variables in User and System Path list

    I also tried to delete the C:\Program Files and C:\Program Files\Scripts from the PATH list to enforce the launcher to use the above location. I restarted the computer every time I made change to the environment variables. However, nothing works. I still get the same error of "The system cannot find the file specified".

    The only workaround is that: I copied the python.exe from C:\Users\xxxx\AppData\Local\Programs\Python\Python313 to C:\Program Files, so the launcher can find the executable file.

    But, I do want to change the launcher's path so it will automatically go to the folder where my Python is installed. Does anyone know how to change it?

    Continue reading...

Compartilhe esta Página