Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named Image

Sorry for my grammar, I don't speak English. After I set filebrowser, tinymce, and grappelli, I get this error: No module named Image

try:     from PIL import Image except ImportError:     import Image 

I set it to PIL but it didn't solve the problem. my platform windows

If i want: pip install PIL

`c:\Users\Kim\BitNami DjangoStack projects\homex8>pip install PIL Downloading/unpacking PIL   Running setup.py egg_info for package PIL     WARNING: '' not a valid package name; please use only.-separated package names in setup.py  Installing collected packages: PIL   Running setup.py install for PIL     WARNING: '' not a valid package name; please use only.-separated package names in setup.py     building '_imaging' extension     error: Unable to find vcvarsall.bat` 

I do not understand what that means

Solved problem. reinstall PIL with easy_install, and more movements, here are the details.

like image 923
Homex Avatar asked Aug 19 '12 05:08

Homex


People also ask

Why is PIL not working?

The Python error "ModuleNotFoundError: No module named 'PIL'" occurs for multiple reasons: Not having the Pillow package installed by running pip install Pillow . Installing the package in a different Python version than the one you're using. Installing the package globally and not in your virtual environment.

How do I know if PIL is installed?

Step 2: To check if PIL is successfully installed, open up the python terminal by typing python3 in the terminal. This will open up the python3 interactive console now type the following command to check the current version of the PIL. This will output the currently installed version of the PIL.

How do I open an image in Python?

Image. open() Opens and identifies the given image file. This is a lazy operation; this function identifies the file, but the file remains open and the actual image data is not read from the file until you try to process the data (or call the load() method).


1 Answers

You are missing PIL (Python Image Library and Imaging package). To install PIL I used

 pip install pillow 

For my machine running Mac OSX 10.6.8, I downloaded Imaging package and installed it from source. http://effbot.org/downloads/Imaging-1.1.6.tar.gz and cd into Download directory. Then run these:

    $ gunzip Imaging-1.1.6.tar.gz     $ tar xvf Imaging-1.1.6.tar     $ cd Imaging-1.1.6     $ python setup.py install 

Or if you have PIP installed in your Mac

 pip install http://effbot.org/downloads/Imaging-1.1.6.tar.gz 

then you can use:

from PIL import Image 

in your python code.

like image 77
user1119116 Avatar answered Sep 23 '22 12:09

user1119116