Problem using PIL in a Django application on Windows

I am learning a bit of Django with Python Web Development with Django . Everything went well until I tried to create a photos application that requires PIL (Python Image Library). When I try to add an image through the admin interface, I get the error message inserted below.

I am running Windows 7, Python 2.7, Django 1.3b1, and XAMPP 1.7.3 with the wsgi module installed successfully (at least I think so, since my other Django experiments work fine).

Following the troubleshooting guide from the PIL site, I tried to import the PIL modules at the Python prompt:

>>>import _imaging >>>import Image 

Both work fine without displaying an error. However, trying to start a Django admin application using PIL results in:

ImportError at / admin / items / photo / add / The _imaging C module is not installed Request method: POST Request URL: http: // localhost: 8888 / photos / admin / items / photo / add / Django Version: 1.3 beta 1 SVN -15679 Type of exception: ImportError Exclusive value:
The _imaging C module is not installed. Exception Location: C: \ Python27 \ lib \ site-packages \ PIL \ Image.py in getattr , line 37 Python executable: C: \ xampp \ apache \ bin \ httpd.exe Python Version: 2.7. 0 Python path:
['C: \ python27 \ Lib \ site_packages \ IPython-0,10-py2.7.egg', 'C: \ python27 \ Lib \ site_packages \ SQLAlchemy-0.6.4-py2.7.egg' , 'C: \ python27 \ Lib \ site-packages \ openglcontext_full-2.1.0a7-py2.7.egg', 'C: \ python27 \ Lib \ site-packages \ ttfquery-1.0.4-py2.7.egg' , 'C: \ python27 \ Lib \ site packages \ fonttools-2,3-py2.7-win32.egg', 'C: \ python27 \ Lib \ site packages \ pydispatcher-2.0.2-py2.7. egg ',' C: \ python27 \ Lib \ site-packages \ PySide-1.0.0beta1qt471-py2.7-win32.egg ',' C: \ code \ ot ',' C: \ Lib \ Django ',' C : \ code ',' C: \ XAMPP ',' C: \ Windows \ system32 \ python27.zip ',' C: \ python27 \ Lib ',' C: \ python27 \ DLL files ',' C: \ python27 \ Lib \ Lib-mk ',' C: \ XAMPP \ Apache \ bin ',' C: \ Users \ garethconner \ AppData \ Roaming \ Python \ python27 \ site packages ',' C: \ python27 ',' C: \ python27 \ lib \ site packages', 'C: \ python27 \ lib \ site packages \ PIL', 'C: \ lib \ django \ django', 'C: \ python27 \ lib \ site packages \ win32', 'C: \ pytho n27 \ Lib \ site-packages \ win32 \ Lib ',' C: \ python27 \ Lib \ site-packages \ Pythonwin ',' C: \ python27 \ Lib \ site-packages \ Setuptools-0.6c11-py2.7.egg -info ',' C: \ python27 \ Lib \ site-packages \ WX-2.9.1-MMZ ',' C: \ code ']

Any help would be greatly appreciated.

+4
source share
2 answers

I answered this earlier here

Just install the precompiled binaries for Windows (for your python version) from http://www.lfd.uci.edu/~gohlke/pythonlibs/

+7
source

This worked for me when the same installer (windows, Python2.7) downloaded from the official PIL website did not work. Thanks!

+1
source

Source: https://habr.com/ru/post/1344274/


All Articles