I was creating a virtual environment in python 3.7.9 but vscode is creating an environment in python 3.9.12 (I have anaconda installed with that version). I used the command ctrl shift p
to change the environment to 3.7.9 but it's created in 3.9.12. I had to uninstall anaconda to create an environment. How to fix this?
CodePudding user response:
Steps to change the Python version in VS Code:
- change to your project path (e.g. using
cd
) - create a new virtual environment (
venv
) using your Python binary in the given version (e.g.python3.7
):`which python3.7` -m venv .venv
- change your VS Code interpreter by clicking in the status-bar (see red rectangle below)
CodePudding user response:
There is a corresponding relationship between Python version and CONDA version.
A simple modification of interpreter cannot change the python version. You must install the CONDA environment of the corresponding version of Python.
Here is the download page of conda