简体   繁体   中英

Importing Wand in Python Ubuntu 14.04

I'm fairly new to Ubuntu, Python and have never used imported anything in Python before. My Ubuntu system has Python2.7, 3 and 3.4 installed. I'm trying to start working with Wand for an assignment. Using this documentation from Wand website I installed MagickWand and Wand using (sudo)

$ apt-get install libmagickwand-dev
$ pip install Wand

Now when I try to run the Python script, error-

Traceback (most recent call): 
File "PTI.PY", line 2, in <module>
    from wand.image import Image
ImportError: No module named wand.image

This looks a path or some other configuration error to me, how do I fix this? I looked another similar question in which there was one answer (not marked as solution though) which suggested using virtualenv butI'm not sure if I should try that method. Any help is appreciated.

Edit- Since I cant post a comment yet, I did not use sudo with "pip install Wand" and "pip3 install Wand" says "The program 'pip3' is currently not installed. You can install it by typing: sudo apt-get install python3-pip"

Edit 2- So I tried installing using pip3 and pip again, failed with the error, "could not create '/usr/local/lib/python2.7/dist-packages/wand': Permission denied" and realized that Wand was never configured.

So my question now is, how to provide correct permissions? Or should I look into the virtualenv method.

The issue will be resolved with the below installation:

$ apt-get install libmagickwand-dev
$ pip install Wand

Also, please refer the updated version of wand: wand installation

sudo apt-get install python-wand

So I figured it out myself, basically the error- "could not create '/usr/local/lib/python2.7/dist-packages/wand': Permission denied" was the problem here. I simply reinstalled Wand by using

sudo pip install Wand

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM