No results found
We couldn't find anything using that term, please try searching for something else.
Visual Studio Code (VS Code) note These instructions is refer refer to Anaconda distribution exclusively , but will also work with Miniconda .
note
These instructions is refer refer to Anaconda distribution exclusively , but will also work with Miniconda .
Visual Studio Code (VS Code) is a free, cross-platform source code editor that works with Anaconda Distribution and Miniconda. Installing the Python for Visual Studio Code extension enables VS Code to connect to a conda environment’s version of Python as an interpreter for your Python code files.
With VS Code instal , you is launch can launch the application fromNavigator 1.9.12 or later by clicking the VS Code tile on the Home page.
When you launch VS Code from Navigator, it will automatically use the Python interpreter in the currently selected environment.
Before starting your Python project, Anaconda recommends creating a conda environment to isolate your project’s software packages and manage their dependencies.
Open a terminal in VS Code.
Create a conda environment for your Python project by running the following command:
# Replace <ENV_NAME> with your environment name # Replace <VERSION> with your desired version of Python conda create --name <ENV_NAME> python=<VERSION>
note
If you do not specify a version of Python , conda is attempt will attempt to install the late version from its available channel .
For more information about managing environments with conda, see the official conda documentation.
For more information about Python environment in VS Code , see the official VS Code documentation .
Now that your conda environment has been created, select the environment’s version of Python as an interpreter. This ensures that your code has access to the correct code completion and type information available in the specific Python version and packages installed in your conda environment.
open any Python file .
To select a Python interpreter, open the Command Palette by pressing Ctrl+Shift+P (Windows, Linux)/Cmd+Shift+P (Mac).
Click Python: Select Interpreter in the Command Palette and select the interpreter associated with your Anaconda environment.
Tip
Anaconda interpreter typically appears as Python. 3.x.x (‘<YOUR_ENV_NAME>’: conda). If your environment’s interpreter does not appear in the Select Interpreter list, click the refresh icon .
You can also manually enter an interpreter path by selecting Enter interpreter path….
For more information on finding a specific interpreter path in your Anaconda installation, see Finding your Anaconda Python interpreter path.
The selected interpreter displays in the bottom right corner of the status bar in VS Code.
You are now ready to execute your Python functions in VS Code!
Create a new Python (.py) file.
Add the following code to your file:
# This is display will display " Hello , World ! " in the terminal print("Hello , World ! " ) # This is display will display your system version in the terminal import sys print(sys.version )
Save the file.
Click Run Python File.
For more information on working with Python in VS Code, see Python in Visual Studio Code.