Work with Python environments

ArcGIS Pro includes a package manager that allows you to interact directly with conda without leaving ArcGIS Pro.

To access Python when working in ArcGIS Pro, click the Project tab and click Python to access the Python Package Manager. To create, edit, or remove environments, click the Manage Environments button.

Learn more about working with Python packages in an environment

Attention :

Modifying the ArcGIS Pro default Python environment (arcgispro-py3) is not advisable and may result in unintended consequences. It is recommended that you only modify a cloned environment.

Create an environment

To create a clone of the default arcgispro-py3 environment, on the Manage Environments dialog box, click the Clone Default button Clone. The new environment is a copy of the arcgispro-py3 environment, and only the default packages included with ArcGIS Pro will be installed.

Clone a Python environment.

You can also create a clone of any environment, including the arcgispro-py3 environment, by clicking the environment and clicking the Clone button Clone. This opens the Clone Environment dialog box, where you can set the environment's name and path.

By default, the environment is created in your %LocalAppData%\Esri\conda\envs folder. To create the environment in a different folder, click the Browse button Parcourir on the Clone Environment dialog box and browse to the folder.

Activate an environment

The active Python environment is used to run any Python functionality executed in the application, such as code executed in the Python window, script tools, and Python toolbox tools. To change the active environment, on the Manage Environments dialog box, select the environment and click OK. After changing the active environment, you may need to restart ArcGIS Pro to reinitialize Python and use the new environment.

Remarque :

An environment that does not include ArcPy cannot be activated within ArcGIS Pro.

Remove an environment

To delete an environment, click the Remove button Supprimer on the appropriate environment. The default arcgispro-py3 environment cannot be removed.

Add an environment

By default, only environments in two well-known locations (%PROGRAMFILES%\ArcGIS\Pro\bin\Python\envs and %LocalAppData%\Esri\conda\envs) are listed on the Manage Environments dialog box. To include an environment from another location, click the Add button Ajouter.

Rubriques connexes