Problems detecting PythonMagick after install Mac OSX

你。 提交于 2019-12-11 14:08:31

问题


I followed the instructions at https://gist.github.com/2778301 but when I try to do import PythonMagick I get the error message:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "PythonMagick/__init__.py", line 1, in <module>
    from . import _PythonMagick
ImportError: cannot import name _PythonMagick

The PythonMagick.so is in my python2.7 site-packages.

EDIT: I solved this problem by copying from where make install installed PythonMagick /usr/local/lib/python2.7/site-packages/PythonMagick to where Python actually looks on a OS X Lion, /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/


回答1:


There's an answer to your question on the link you provided:

This can be fixed by changing the first line of __init__.py in PythonMagick, which is usually found in the site-packages directory, for instance,

python2.7/site-packages/PythonMagick

Try changing:

from . import _PythonMagick

to

import _PythonMagick


来源:https://stackoverflow.com/questions/10954568/problems-detecting-pythonmagick-after-install-mac-osx

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