背景
ArcGIS Pro像ArcMap一样,其中也嵌入了Python。 不同在于ArcGIS Pro采用了python较新的版本3.4,ArcMap仍然沿用2.x版本。 ArcGIS Pro 1.3版本开始Python环境有点小变化,为了方便包管理esri开始采用Conda。 并且不像开始 ArcGIS Pro 1.1,1.2 版本,需要单独安装Python for ArcGIS Pro,在1.3版本python包随ArcGIS Pro一同自行安装。
文档的原文摘过来能更好的理解esri采用Conda的意图:
Python has a rich ecosystem of preexisting packages that can be leveraged within ArcGIS, but managing which packages are installed on a system can be a complex and time-consuming task, especially when working on multiple projects or trying to share code with others.
To leverage this versatility, the Python community has created methods to easily create projects in multiple versions of Python and simplifies the process of installing nearly all publicly available Python packages. Conda is the most popular and widely used Python package manager.
看到这里,你也也许和我有一样的疑问,啥是Conda? 点 这里 。这页文档是esri刚更新的内容,需要在英文语言版本文档中才能找到。
执行脚本
这些改变,对于习惯在 ArcGIS Pro 内部的脚本命令行中执行脚本的用户并没有多大影响。 但是如果已经习惯了在ArcGIS Pro 之外独立执行脚本,那如下的改变要注意下了。
ArcGIS Pro 的Python包不再是ArcMap默认安装的位置 C:\Python27
,而是安装在 ArcGIS Pro的安装目录\bin\Python
。
ArcGIS Pro 采用了的Conda环境为 arcgispro-py3,有几个方式可以访问这个环境。