pythonpython-3.xpython-venv

Python venv env Fails - [WinError 2] The system cannot find the file specified


I installed the latest version of Python 3.8.2 on a Windows 10 machine. I previously had Python 3.7, which I uninstalled and confirmed in the System PATH it was no longer referenced.

After installing the latest version, I run through CMD as Admin:

py -m venv env

and I get this error:

Error: [WinError 2] The system cannot find the file specified: 'C:\Users\test_user\Documents\app_test\env'

I know the Python Path is in the System Path environmental settings, but not specifically for the user (don't know if that makes a difference?).

I have also tried to uninstall virtualenv using powershell and reinstaling, but have the same result.

Any ideas on where else to look to solve this?


Solution

  • I found out that Windows Defender now has a feature that blocks access/changes to system files. It added my documents folder by default, somehow preventing me from creating any folders in CMD despite having Admin Access. I hope this helps someone else!!

    In short -- you may have to revise or disable your Windows 10 "Ranswomare Security Protection" setting to allow you to write files to your directories.