简体   繁体   English

在Anaconda的Spyder安装中如何使用arcpy模块?

[英]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.

相关问题 如何在spyder anaconda中安装arcpy - How to install arcpy in spyder anaconda 如何在 anaconda spyder 5 上安装“util” - How to install "util" on anaconda spyder 5 如何在Spyder(Anaconda 3)上安装PIL? - How to install PIL on Spyder(Anaconda 3)? 无法在 anaconda (Spyder) 中为 python 安装 googleads 模块 - Unable to install the googleads module for python in anaconda (Spyder) 如何在Anaconda上安装Selenium以及如何在Anaconda的Spyder IDE上使用硒与Scrapy? - How to install Selenium on Anaconda and How to use selenium with Scrapy on Spyder IDE of Anaconda? 如果在 anaconda 提示符下运行没有问题,但是 ModuleNotFoundError: No module named &#39;keras&#39; in Spyder - It's OK if run in anaconda prompt but ModuleNotFoundError: No module named 'keras' in Spyder 无法安装 tensorflow 以与 anaconda 发行版 spyder ide 一起使用,但出现以下错误 - Not able to install tensorflow for use with anaconda distribution spyder ide with bellow error Anaconda安装后Spyder中的错误 - Error In Spyder After Anaconda Install 在 Anaconda 之外的 Spyder 中找不到模块 - Module not found in Spyder outside of Anaconda 模块在 Anaconda 提示符下工作,但在 Spyder 中不工作 - A module is working in Anaconda prompt, but not in Spyder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM