在Mac OS X Yosemite上安装Python geojson模块以与QGIS一起使用 [英] Installing the Python geojson module on Mac OS X Yosemite to use with QGIS

查看:119
本文介绍了在Mac OS X Yosemite上安装Python geojson模块以与QGIS一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用QGIS,所以这个问题可能真的很容易,但我只是无法在网上找到答案.

I am new to using QGIS so this question might be real easy but I just can't find the answer anywhere online.

我需要在QGIS中使用模块geojson,但尚未安装".我用过import geojson并说No module named geojson所以我的问题是,如何在QGIS或专门的PyQGIS中安装geojson?

I need to use the module geojson in QGIS but it is not yet "installed". I've used import geojson and it says No module named geojson So my question is, how do I install geojson in QGIS or specifically PyQGIS?

我已经从名为geojson-1.0.9的网站下载了geojson.我应该将geojson复制到哪个文件夹中,以便PyQGIS可以找到geojson python模块.

I've already downloaded geojson from a website called geojson-1.0.9. Which folder should I copy geojson into so that PyQGIS can find the geojson python module.

谢谢!

推荐答案

我设法弄清楚了如何做到这一点.

I managed to figure it out myself on how to do this.

我正在使用2012年中运行Mac OS X Yosemite版本10.10.2的Macbook Pro 13"

I am using a Macbook Pro 13" mid-2012 running OS X Yosemite ver. 10.10.2

无论QGIS如何,Mac上都已经安装了Python(QGIS Python控制台使用原始的Mac Python安装),因此要安装模块"(类似于R中的"package"),则必须先下载模块.因此,对于"geojson":

Python has already been installed on the Mac regardless of QGIS (QGIS Python console uses the original Mac Python installation), so to install a "module" (similar to "package" in R) you would have to download the module first. So in the case of "geojson":

  1. 从以下位置下载tar模块: https://pypi.python.org/pypi/geojson/
  2. 下载后,tar文件通常位于下载"文件夹中.
  3. 从应用程序文件夹中运行终端"应用程序.
  4. 在终端应用程序中,导航到下载"文件夹,然后使用cd(例如,cd Downloads/)键入python setup.py install.请注意,如果文件夹受密码保护,则可能需要使用sudo(例如sudo python setup.py install),在该位置需要输入管理员密码才能继续操作.
  5. 该模块将安装在适当的文件夹中,即隐藏的python文件夹(版本2.6或2.7)中的"site-packages"文件夹.对于我来说,它是2.7.
  1. Download the tar module from: https://pypi.python.org/pypi/geojson/
  2. After downloading, the tar file would normally be in the Downloads folder.
  3. Run the "Terminal" app from the applications folder.
  4. Within the terminal app, navigate to the Downloads folder and type python setup.py install by using cd, for example cd Downloads/. Note that you might need to use sudo such as sudo python setup.py install if the folder is password-protected where you need to input the admin's password to proceed.
  5. The module would be installed in the appropriate folder i.e. the "site-packages' folder within the hidden python folder (either version 2.6 or 2.7). For me it was 2.7.

现在,您可以在QGIS中使用geojson模块.通过在QGIS Python控制台中键入import geojson对其进行测试.

Now you can use the geojson module in QGIS. Test it by typing import geojson in the QGIS Python console.

这篇关于在Mac OS X Yosemite上安装Python geojson模块以与QGIS一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆