I am switching from Pycharm to Visual Studio as my Python script IDE.
I have been trying to create an environment for ArcGIS Pro but I had no success so far.
I can create Custom Environment from the existing environments but it directly uses the environment for ArcGIS Pro.
I would rather use the ArcGIS Pro Python (3.6) as a base interpreter and create a separate environment.
Anyone has the same problem or am I doing something wrong here?
-
See gis.stackexchange.com/questions/203380/…Midavalo– Midavalo ♦2020年03月07日 00:34:09 +00:00Commented Mar 7, 2020 at 0:34
-
@Midavalo thank you for your comment but I already found this. This method uses the environment comes with ArcGIS Pro.Amadeus– Amadeus2020年03月07日 01:14:57 +00:00Commented Mar 7, 2020 at 1:14
1 Answer 1
Here's what I do for Visual Studio Code and it works out pretty well for me. I use this code in a .cmd
file to create a conda environment for my project, based off of the arcgispro-py3
environment. This will mirror that environment, so arcpy
will work (change paths and venv names accordingly - I use a custom place to store my venvs so I really know where they all are):
cd "C:\sw\Program Files\ArcGIS\Pro\bin\Python\Scripts"
call activate root
call conda create --clone arcgispro-py3 --prefix c:/sw/conda-envs/traffic-incidents
call activate c:/sw/conda-envs/traffic-incidents
call conda install -y pyodbc
Next, tell Visual Studio Code where to look for the venvs. In settings.json
, add/set python.venvPath
to where your conda envs live:
"python.venvPath": "C:\\sw\\conda-envs"
For Visual Studio, once you have created your env you can set the Python env much like you can in PyCharm in the settings. See here for more on that. Much like in PyCharm, you can also create environments directly in the Visual Studio interface.
Explore related questions
See similar questions with these tags.