Graphics folder modules will not import after several installs (Mac OSX)

半腔热情 提交于 2019-12-20 04:43:11

问题


A similar problem with the python gdal module Gdal will not import after several installs (Mac OSX) was solved by modifying my shell profile to ensure MacPorts-installed ports are found, and then using sudo port select python python27.

But this time it's every module in my graphics folder that deals with tiff and png reading and writing that will not import:

tiff @3.9.5 graphics/tiff

pngpp @0.2.3 graphics/pngpp

libgeotiff @1.3.0 graphics/libgeotiff

Again, when I run python to import either module I get the similar response:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named png

What am I doing wrong?


回答1:


For most Python packages, MacPorts has separate ports available for each supported Python version. For example, if you are trying to use PIL (the Python Imaging Library), you need to install the 2.7 version of that port:

sudo port install py27-pil

That will also install the MacPorts version of Python 2.7, if you don't already have it installed. It is located at /opt/local/bin/python2.7.



来源:https://stackoverflow.com/questions/7110885/graphics-folder-modules-will-not-import-after-several-installs-mac-osx

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