gis里面python框_Windows10 下GRASS GIS Python 环境配置问题

本文档详细介绍了在Windows10上配置GRASS GIS Python环境的过程,包括设置GIS数据库、指定GRASS启动文件,以及解决GRASS GIS运行时调用错误.dll文件的问题。通过Dependencies和Process Explorer来定位并解决依赖库冲突,最终成功运行GRASS GIS Python脚本。
摘要由CSDN通过智能技术生成

因为想要在Spyder中直接调用GRASS的Python包,实现在外部的IDE中运行GRASS,直接在Spyder中输入官网给出的实现代码,根据实际情况更改gisdb,grassbin目录等:

import os

import sys

import subprocess

#定义GRASS数据库

#添加自己的grassdb数据库路径

gisdb = os.path.join(os.path.expanduser("~"), "grassdata")

# the following path is the default path on MS Windows

# gisdb = os.path.join(os.path.expanduser("~"), "Documents/grassdata")

#指定现有location和mapset

location = "nc_spm_08"

mapset = "user1"

#指定GRASS的启动文件

grass7bin = 'grass78'

if sys.platform.startswith('win'):

# MS Windows

grass7bin = r'C:Program FilesGRASS GIS 7.8grass78.bat'

# uncomment when using standalone WinGRASS installer

# grass7bin = r'C:Program Files (x86)GRASS GIS 7.8.0grass78.bat'

# this can be avoided if GRASS executable is added to PATH

elif sys.platform == 'darwin':

# Mac OS X

# TODO: this have to be checked, maybe unix way is good enough

grass7bin = '/Applications/GRASS/GRASS-7.8.app/'

# query GRASS GIS itself for its GISBASE

startcmd = [grass7bin, '--config', 'path']

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值