How do you get Visual Studio Code to use different Python interpreter?
Open command pallete with F1
(on Windows) and type Python: Select Interpreter
.
VSCode change default python version
In VSCode's command palette choose the option
Python: Select Interpreter
And choose the interpreter you want to use. This will automatically add the setting correctly to your settings.json
file in your .vscode
folder for your workspace.
This will take care of Python management in VSCode.
Now coming to setting the right python to be used by your os/terminal when trying to run scripts.
Since you are using linux, make sure your python is the right version thats linked
- Check python version on terminal -
python --version
- execute
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
<< verfiy your paths correctly - then run
sudo update-alternatives --config python
- Select the python version
- Try
python --version
again and check
If on Windows make sure path to Python 3.8.x is set at a higher priority in your Path Environment Variable. Py3 should be above your other paths
Related Topics
Conditionally Fill Column Values Based on Another Columns Value in Pandas
Importing from a Relative Path in Python
Selenium Element Not Visible Exception
Check If a Process Is Running or Not on Windows
How to Convert a Timezone Aware String to Datetime in Python Without Dateutil
Efficient Numpy 2D Array Construction from 1D Array
Opencv Real Time Streaming Video Capture Is Slow. How to Drop Frames or Get Synced with Real Time
Python Global Exception Handling
Cast Base Class to Derived Class Python (Or More Pythonic Way of Extending Classes)
How to Make a 4D Plot with Matplotlib Using Arbitrary Data
Python Selenium Chrome Webdriver
Creating a Bat File for Python Script
Failed to Get Convolution Algorithm. This Is Probably Because Cudnn Failed to Initialize,
How to Capture Output of Python's Interpreter and Show in a Text Widget