How to fix Error: [Errno 2] No such file or directory: 'C:\\Program Files\\Python37\\lib\\venv\\scripts\\nt\\python_d.exe'

Villani picture Villani · Mar 27, 2019 · Viewed 24.8k times · Source

I'm using the latest version of Python on Windows and I'm trying to use venv with the following code:

C:\envs> py -m venv test

Even if it actually creates the venv, it returns this error and I don't understand why. Moreover I can't activate the venv, the code

C:\envs> C:\envs\test\Scripts\activate.bat

returns

"C:\envs\test\Scripts\activate.bat" is not recognized as an internal or external command, operable program or batch file.

Answer

Mohit Bhavsar picture Mohit Bhavsar · May 3, 2019

I am using python version 3.7.3 it gave me error states that "No such file or directory: 'C:\python37\lib\venv\scripts\nt\python_d.exe'" at the time of creation of project in pycharm.

I copied following files from python location(C:\Program Files\Python37) to the (C:\Program Files\Python37\Lib\venv\scripts\nt) and it worked for me

1) python_d.exe
2) python_d.pdb
3) pythonw_d.exe
4) pythonw_d.pdb