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?
What Is the FileNotFoundError: [WinError 2] The system cannot find the file specified in Python. The FileNotFoundError is an error that occurs when a file cannot be found. This can be due to many reasons, such as the file being deleted, moved, or renamed. It can also occur if the file never existed in the first place.
If you're using Windows, use the command "venv\Scripts\activate" (without the word source) to activate the virtual environment.
I was facing the same problem. I found out that this is caused by renaming a copy python.exe executable to python3.exe. I did that because I have installed both Python 2.7 and Python 3.9 and configured environmental variables to use Python 2.7 with python command and Python 3.9 using python3 command. So that my paths in environmental variables of Python 2 were above Python 3.
To fix this edit your path variable so that Python 3 path will exist before Python 2 path.
Also if you are using Python2 also, go to the installed location and create a copy of python.exe executable and rename it as python2.exe.
Then when you run python command it will direct to the Python 3 and to use Python 2 you can use python2 command.
You can find more information on this by following this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With