2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 使用jupyter 调取arcgis中arcpy

使用jupyter 调取arcgis中arcpy

时间:2019-10-03 07:32:19

相关推荐

使用jupyter 调取arcgis中arcpy

使用jupyter 调取arcgis中arcpy

1.前言

首先,ESRI公司推出了Arcgis pro,其中包含了python3.X版本,并且其结构类似于anconda,可以安装虚拟环境,扩增库,最重要的是,可以导入 arcpy的包,使用其工具栏下的所有工具

这个arcgis pro 的确是真香好用,它在官网可以进行免费的21天使用,但是在使用完之后又不想掏钱怎么办,最近,我就需要用arcpy做批量化的处理,但是arcgis自带的GUI无法反复调试,真的是很折磨人,其次,arcgis pro 的免费申请老是把我毙掉,所以有没有其它办法使用 arcpy呢

2.解决方法

2.1升级arcgis 下的pip文件

首先找到arcgis 下的python 安装目录

如图所示,我的是在c盘

进入Scripts中,打开cmd

pip -V

可是查看版本,然后输入命令

python -m pip install --upgrade pip

对pip进行升级

2.2 安装jupyter notebook

使用命令

pip inastall notebook

出现如下所示为成功

运行jupyter notebook

打开之后,导入arcpy测试一下

3.安装过程中会遇到的坑

3.1 没有配置python环境

如果没有配置环境,在需要使用pip时,必须在python27\arcgis10.x\Scripts下打开命令行,否则运行的pip不是arcgis 中python环境的pip

这个时候可以使用

pip show pip

来查看pip的版本和路径是否正确

这个时候如果需要运行arcgis中的python需要在python27\arcgis10.x中运行cmd来打开python ,打开之前使用python -V来查看一下python的版本号

3.2 解决方法

配置python27的环境变量,这样就可以在powershell中打开

我的电脑–>右击 -->属性

进入之后—>环境变量—>系统变量,设置如下

3.3 安装过程中部分包不符合版本条件

其中我在安装过程中,出现如下问题

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-E7oVkM1e-1618582870345)(如何在Arcgis10.x中使用jupyter调取python.assets/image-0416221145262.png)]

ERROR: Package 'pyrsistent' requires a different Python: 2.7.14 not in '>=3.5'

3.4 解决方法

pip install pyrsistent==0.16.1

3.5安装命令出错

注意,安装jupyter 的命令是 pip install noebook 不是pip install jupyter

否则会出现一下错误

ERROR: Command errored out with exit status 1:command: 'c:\python27\arcgis10.6\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\rhf\\appdata\\local\\temp\\pip-install-kjthfg\\qtconsole\\setup.py'"'"'; __file__='"'"'c:\\users\\rhf\\appdata\\local\\temp\\pip-install-kjthfg\\qtconsole\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'c:\users\rhf\appdata\local\temp\pip-pip-egg-info-l9tr8x'cwd: c:\users\rhf\appdata\local\temp\pip-install-kjthfg\qtconsole\Complete output (6 lines):Traceback (most recent call last):File "<string>", line 1, in <module>File "c:\users\rhf\appdata\local\temp\pip-install-kjthfg\qtconsole\setup.py", line 18print(error, file=sys.stderr)^SyntaxError: invalid syntax----------------------------------------ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。