You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无需Anaconda安装ArcGIS API for Python及解决Jupyter报错

ArcGIS API for Python 问题排查与环境对比

一、Jupyter Notebook 中 AttributeError 解决方案

错误重现代码

from arcgis.gis import GIS
my_gis = GIS()
m = my_gis.map()

m

错误日志

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~\LocationVenues\py_venv\lib\site-packages\IPython\core\formatters.py:920, in IPythonDisplayFormatter.__call__(self, obj)
    918 method = get_real_method(obj, self.print_method)
    919 if method is not None:
--> 920     method()
    921     return True

File ~\LocationVenues\py_venv\lib\site-packages\arcgis\widgets\_mapview\_mapview.py:948, in MapView._ipython_display_(self)
    942 """Override the parent ipython display function that is called
    943 whenever is displayed in the notebook. Display a blank area
    944 below the map widget that can be controlled via a display handler
    945 set to self._preview_image_display_handler.
    946 """
    947 self._setup_gis_properties(self.gis)
--> 948 super(MapView, self)._ipython_display_()
    949 self._preview_image_display_handler = display(
    950     HTML(self._assemble_img_preview_html_str("")),
    951     display_id="preview-" + str(self._uuid),
    952 )
    953 self._preview_html_embed_display_handler = display(
    954     HTML(self._assemble_html_embed_html_str("")),
    955     display_id="preview-html-" + str(self._uuid),
    956 )

AttributeError: 'super' object has no attribute '_ipython_display_'

可行解决办法

  • 版本兼容调整:该错误多因ArcGIS API for Python与IPython/Jupyter版本不匹配导致,可指定安装稳定版本:
    python3 -m pip install arcgis==2.2.0
    
  • 更新IPython依赖:确保Jupyter环境的IPython版本满足ArcGIS API要求:
    python3 -m pip install --upgrade ipython
    
  • 临时替换渲染方式:若版本问题暂时无法解决,改用静态截图渲染地图:
    from arcgis.gis import GIS
    my_gis = GIS()
    m = my_gis.map()
    m.basemap = "streets"
    m.center = [34.0522, -118.2437]
    m.take_screenshot()
    

二、Anaconda 与独立 Python 环境安装的区别

  • 环境管理能力:Anaconda自带conda工具,可一键创建隔离虚拟环境,自动处理依赖冲突;独立环境需手动用venv/virtualenv创建,依赖管理全靠pip,复杂场景易出问题。
  • 预装依赖差异:Anaconda默认预装numpy、pandas等大量数据科学基础库,ArcGIS API安装时无需额外配置;独立环境需手动安装所有底层依赖。
  • 性能优化:Anaconda针对数据科学场景优化,部分库采用MKL等加速编译版本,理论上地图渲染、数据处理效率更高;若独立环境手动安装同版本优化库,性能差距可忽略。
  • 部署灵活性:Anaconda适合团队统一环境配置,多为全局安装;独立环境更轻量化,适合单个项目极简部署,打包分发体积更小。

内容的提问来源于stack exchange,提问作者kyrlon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 21:22:03