I am running into some issues when I try to import Wand (an ImageMagick binding for Python).
Here's what's happening:
from wand.image import Image
getting the standard error message:
ImportError: No module named wand.image
Yes, Wand is installed, I used
pip install Wand
From what I understand, it depends on imagemagick so I also needed to do this:
brew install imagemagick
Still no luck. As far as I know, it should be able to import fine now, but it's not.
Other info: I am using homebrew on Mac and python 2.7 and I tried messing with virtual environments, but still couldn't get it to work. I have a hunch that I have something going wrong with my path, but I cannot figure out how to further troubleshoot this. I have uninstalled both imagemagick and wand and tried to reinstall them. I'm pretty inexperienced with python, any help is appreciated because I'm trying to learn! I read that I should check my sys.path, but when I print it I do not know what I'm checking for.
Thanks everyone.
Please use virtualenv, and re-do a pip install of wand inside an activated sandbox.
# Install virtualenv system-wide
sudo pip install virtualenv
# Create a python sandbox
virtualenv my_sandbox
# Activate sandbox session
. ./my_sandbox/bin/activate
# Install wand into sandbox environment
pip install wand
# Test installation
python -mwand.version
#=> 0.4.2
How to properly import Wand to python?
You are correct in importing wand.image.Image
with the following.
from wand.image import Image
# ...
with Image(filename='rose:') as img:
pass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With