A popular IDE for developing and debugging code, you can have VS Code automatically detect and recommend the right runtime for your project. This allows you you to work with the security and compliance assurances that your ActiveState project already has directly from your IDE.
Before you can use your ActiveState projects Python interpreter in your VS Code environment, make sure the following conditions are met.
The State Tool is installed on your local machine and is updated to V.36 or later. To update your State Tool, open your command terminal and enter state update
.If you have installed the State Tool after opening VS Code you will need to restart VS Code for the changes to take effect.
You have the newest version of the VS Code Python extension installed (version 2023.5.10672245 or later). Click here to learn more about updating VS Code extensions.
Begin by creating a Python file in your project, or opening an existing Python file. If this is a new file you may be prompted to select an interpreter, or if it is an existing file you can select a new interpreter using the VS Code Command Palette.
To access the “Select Interpreter” drop down from the Command Palette, press Shift + Ctrl + P on Windows and Linux or Shift + Cmd + p on macOS and click Python: Select Interpreter.
This will automatically generate a list of all of the interpreters available on your machine (including those provided by ActiveState). Click to select your preferred interpreter and begin working on your file.
After making your selection your new interpreter will be displayed at the bottom of the VS Code window (“andrewd-activestate/PythonWindows3’:ActiveState” shown above).
When working with an ActiveState project folder containing your project’s activestate.yaml
file, the associated project’s interpreter will be automatically chosen as the default interpreter (or the “recommended” interpreter) for that file.
You can verify this by opening the VS Code Command Palette (Shift + ctrl + P on Windows and Linux, shift + cmd + p on macOS) and click Python: Select Interpreter to check that the correct interpreter has been selected. The interpreter associated with your project will be listed with a star next to the name and a “Recommended” tag.
If your preferred ActiveState interpreter is not immediately available in the “Select Interpreter” dropdown see below for solutions.
python.activeStateToolPath
under the “Settings” list.activestate.yaml
file (or a subdirectory of that directory) and enterstate export env
This will return the path to the executable shown below.