Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 313
Villani Avatar asked Mar 27 '19 14:03

Villani


3 Answers

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

like image 128
Mohit Bhavsar Avatar answered Nov 14 '22 13:11

Mohit Bhavsar


As Villani mentioned in his own comment, it's a debug binaries problem.

It will be fixed in the upcoming 3.7.4 release. (Planned for 24/06)

Either downgrade to 3.7.2 or install without debug binaries.

like image 27
kazaamjt Avatar answered Nov 14 '22 12:11

kazaamjt


In Anaconda prompt type these commands:

conda remove anaconda
conda update python
conda list --show-channel-urls | findstr python
python -m venv venv
like image 4
user11540040 Avatar answered Nov 14 '22 14:11

user11540040