skip to Main Content

I am using VSCode with ArcGIS Pro 3.0 in a virtual environment. Until yesterday, everything worked just fine. After updating to Pro 3.0, I was still able to use open a script and then have it run in the terminal window.

Previously, I was able to select a line from the script, run it, and then it would open the correct interpreter. However, now I am unable to do so and cannot troubleshoot why this is happening. I have added the correct path to the ArcGIS Pro python executable in the interpreter path, but the terminal opens to another python executable. Any advice would be greatly appreciated as to how I can run specific python executable that I want to run.

2

Answers


  1. You should be able to point VSCode to a specific python interpreter in a virtual environment – you can access this via View > Command Palette > Python: Select Interpreter

    Select Interpreter Window

    Then once you open a .py file you should see the python interpreter in the bottom right portion of the window, and if you open a new terminal it will use that specified interpreter

    Some other references:

    Login or Signup to reply.
  2. To select a specific Python interpreter with ArcGIS Pro 3.0 within a virtual environment in Visual Studio Code (VSCode), you can follow these steps:

    1. create a virtual environment. ArcGIS Pro 3.0 comes with its own Python installation, you need to ensure that the virtual environment is set up correctly to use that Python version.

      python -m venv myenv

    2. Activate the virtual environment.
      on windows: myenvScriptsactivate
      on macos : myenv/bin/activate

    3. Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) to open the Command Palette.

    4. Type Python select interpreter and press Enter.

    5. In the list of available interpreters, you should see the Python interpreter from your virtual environment. It might be named something like "myenv".

    6. Select the desired Python interpreter from the list

    now you will get your desired interpreter.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search