[英]How to use arcpy module in Anaconda's install of Spyder?
I recently installed Anaconda's Python distribution, which includes Spyder IDE. 我最近安装了Anaconda的Python发行版,其中包括Spyder IDE。 I am interested in importing the ArcGIS 10.3 arcpy
module in Spyder. 我对在Spyder中导入ArcGIS 10.3 arcpy
模块感兴趣。 Unfortunately, running import arcpy
results in the following error: 不幸的是,运行import arcpy
导致以下错误:
import arcpy
Traceback (most recent call last):
File "<ipython-input-2-50d283eebbb3>", line 1, in <module>
import arcpy
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\__init__.py", line 21, in <module>
from arcpy.geoprocessing import gp
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from _base import *
File "C:\Program Files (x86)\ArcGIS\Desktop10.3\arcpy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
ImportError: No module named arcgisscripting
To resolve this error, I have tried 1) changing the interpreter to ArcMap.exe
and 2) moving the Desktop10.1.pth
file, both as shown in this SE post . 要解决此错误,我尝试了1)将解释器更改为ArcMap.exe
以及2)移动Desktop10.1.pth
文件,如本SE帖子所示。 Solution #1 crashes Spyder and solution #2 has no effect. 解决方案1崩溃Spyder,解决方案2不起作用。
What steps are needed to be able to import and use the arcpy
module in the Anaconda distribution of Spyder? 要导入和使用Spyder的Anaconda发行版中的arcpy
模块,需要执行哪些步骤?
A good explanation on how to do this here 如何做一个很好的解释在这里
To allow other Python installations to access Arcpy a file must be copied from the \\Lib\\site-packages\\ folder within the Arc Python installation and placed in the corresponding folder of the non-Arc Python. 要允许其他Python安装访问Arcpy,必须从Arc Python安装内的\\ Lib \\ site-packages \\文件夹中复制一个文件,并将其放置在非Arc Python的相应文件夹中。 If you have not installed 64-bit background geoprocessing the file is Desktop10.1.pth; 如果尚未安装64位背景地理处理,则文件为Desktop10.1.pth; if you have installed it, the file is DTBGGP64.pth. 如果已安装,则文件为DTBGGP64.pth。
I strongly recommend reading that post. 我强烈建议您阅读该文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.