Reputation: 313
I want to set up a python3 virtual environment in my Workspace. I have two versions of python, installed in the following paths: C:\Python\Python27\python2.exe
C:\Python\Python38\python3.exe
. I already checked on the powershell terminal that they are properly installed.
I tried the command python3 -m venv .venv
. It created a .venv
folder, but I get the following error message: "Error: [Win Error2] The system cannot find the file specified
.
My IDE is Visual Studio Code 1.39.2
Also, Python3 is added to path in the Variable environment C:\Python\Python38
I also tried to use the command py -3 -m venv .venv
, but then I get:
Python 3 not found! Installed Pythons found by C:\WINDOWS\py.exe
launchers for Windows
No Installed Pythons found
I also already executed the command Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
but nothing changed.
My settings.json file:
{ "python;pythonPath": "C:\\Python\\Python38\\python3.exe" }
My pyvenv.cfg file:
home = C:\Python\Python38
include-system-site-package = false
version = 3.8.0
Upvotes: 6
Views: 19103
Reputation: 1
This will target the specific environment and install whatever you're installing directly into the relative site-packages folder associated with that specific environment.
"DRIVE*LETTER:\absolute\path\to\Scripts\python.exe" pip.exe install MODULE\PACKAGE*TO*INSTALL
Hope this helped.
Upvotes: 0
Reputation: 1
on windows, use command prompt with admin access (open as administrator)
Upvotes: -1
Reputation: 1045
What I'd suggest is to use absolute path to your Python 3 folder when executing command, eg.:
"%USERPROFILE%\AppData\Local\Programs\Python38\python.exe" -m venv .env
This solved the problem in my case.
Upvotes: 4
Reputation: 283
Bit late to the party here, but I had the same issue which I realised was only happening when I create a venv inside a onedrive folder "C:\Users\username\OneDrive - company\Documents\". When I changed path to "C:\tmp" the exact same code worked.
Not sure exactly why this happens though.
Upvotes: 3
Reputation: 466
Search for Environment Variables double click the path and click new and set your path
' C:\Python\Python38 '
You should be good.
Upvotes: 0