Installing the Python geojson module on Mac OS X Yosemite to use with QGIS

半腔热情 提交于 2019-12-04 20:24:10

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

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

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. 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.

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!