There are three ways to access arcpy
.
- In ArcGIS Pro via the Python interpreter or Notebooks
- In ArcGIS Online Notebooks using Advanced Python 3 kernel
- From the command line on Windows by activating the ArcGIS Pro Python environment
Two methods require you to have access to a Windows computer; these instructions are for one of them.
If you want access to arcpy
from the command line to run alongside your own code and other third-party Python packages, follow these instructions.
- Open ArcGIS Pro and go to Settings (bottom left) and click on Python
- Click on Manage Environments
- Clone ArcGIS Pro python environment and name it (e.g., ‘adv-gis’)
- This can take a while
- Note: if you activate the cloned environment, you can update existing and install third-party packages from the Python interpreter in ArcGIS Pro or Notebooks environment
- Update your user “Path” environment variable to point to
...\Program Files\ArcGIS\Pro\bin\Python\Scripts\
- This folder contains the activate.bat, which you need to access the conda virtual Python environment
- Open a new Command Prompt window and type
activate adv-gis
- Try loading arcpy from Python
python -c "import arcpy; print(arcpy.__name__)"