Home > other >  Consult vscode configuration python virtual environment problems
Consult vscode configuration python virtual environment problems

Time:09-18

Python installation path: d:/develop/Python/python38
Virtual environment directory: d:/develop/envs
Create a virtual environment path: d:/develop/envs/dev

Vscode user configuration file:
"Python. VenvPath" : "d:/develop/envs"
"Python. VenvFolders" :
"Dev"
]

Vscode debugging in python file hints you need to specify the runtime environment, select detected dev environment, then the workspace to generate a file, the file content is a python path:
"Python. Python Path" : "d:/develop/envs/dev/scripts/python. Exe"
This is dev python in a virtual environment. The exe file path,

Now the question is this:

Generated path is not in the user configuration file, but the workspace configuration file, it will follow the project file, but different computer configuration of virtual environment and different, and the path is different also, on the other machine debugging need to reconfigure, how does ability let the configuration information stored in the user configuration file?

Select virtual environment generation is an absolute path, after dead, in computer and have to reconfigure, can call the variables to achieve? Directory select virtual environment can determine the virtual environment, such as I choose the virtual environment of directory is d:/develop/envs/dev, and python directory is d:/develop/envs/dev/scripts/python. Exe, if can use virtual environment path variable substitution, then the way python is {evn}/scripts/python. Exe, if this can be achieved, then replace the virtual environment, the value of the variable evn followed a change, so do not need to reconfigure,

Vscode too many environment variables, has also tried} {config: environment variables before trying to implement the idea of this way, but the result is obviously failed,

The great god, please give directions, thank you!
  • Related