Seite 1 von 1

PIL (Image)

Verfasst: Dienstag 25. September 2012, 20:42
von StefanLawl
War mir nicht sicher, ob das hier hin gehörte, kann gerne verschoben werden. :D

Hab ein Problem mit dem Image Modul:

Code: Alles auswählen

from PIL import Image

bild = Image.open("bild.jpg")

pic = bild.load()
Error:

Code: Alles auswählen

Traceback (most recent call last):
  File "C:\Python27\Scripts\bild.py", line 5, in <module>
    pic = bild.load()
  File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 164, in load
    self.load_prepare()
  File "C:\Python27\lib\site-packages\PIL\PngImagePlugin.py", line 381, in load_prepare
    ImageFile.ImageFile.load_prepare(self)
  File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 231, in load_prepare
    self.im = Image.core.new(self.mode, self.size)
  File "C:\Python27\lib\site-packages\PIL\Image.py", line 37, in __getattr__
    raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
Scheint nicht am Code zu liegen, sondern am Modul, woran kann das liegen?

-Stefan

PS: Sorry, bin sehr müde, konnte die Frage nicht ausführlich schreiben. :|

Re: PIL (Image)

Verfasst: Dienstag 25. September 2012, 23:24
von Sr4l
Ja liegt am Module.

Windows, sieht man ja.
32 / 64 bit?
Wie / woher installiert?

Re: PIL (Image)

Verfasst: Mittwoch 26. September 2012, 15:38
von StefanLawl
Win7 64bit

von http://www.pythonware.com/products/pil/

Hab PIL 1.1.7 Python Imaging Library 1.1.7 for Python 2.7 (Windows only) installiert. (Benutze auch Python 2.7)

Re: PIL (Image)

Verfasst: Mittwoch 26. September 2012, 16:00
von BlackJack
@StefanLawl: Jetzt ist noch die Frage ob Python 32 oder 64 Bit ist, und dann natürlich ob die Bitzahl mit der von PIL übereinstimmt.

Re: PIL (Image)

Verfasst: Mittwoch 26. September 2012, 16:08
von StefanLawl
BlackJack hat geschrieben:@StefanLawl: Jetzt ist noch die Frage ob Python 32 oder 64 Bit ist, und dann natürlich ob die Bitzahl mit der von PIL übereinstimmt.
Bild

Und PIL gab es keine Auswahl, oder ich hab es übersehen :/

Re: PIL (Image)

Verfasst: Mittwoch 26. September 2012, 16:33
von /me
StefanLawl hat geschrieben:Und PIL gab es keine Auswahl, oder ich hab es übersehen :/
Nun ja, der Download-Link geht auf eine Datei mit dem Namen "PIL-1.1.7.win32-py2.7.exe". Das legt nahe, dass es sich um PIL für ein 32bittiges System handelt.

Re: PIL (Image)

Verfasst: Mittwoch 26. September 2012, 16:47
von StefanLawl
/me hat geschrieben:
StefanLawl hat geschrieben:Und PIL gab es keine Auswahl, oder ich hab es übersehen :/
Nun ja, der Download-Link geht auf eine Datei mit dem Namen "PIL-1.1.7.win32-py2.7.exe". Das legt nahe, dass es sich um PIL für ein 32bittiges System handelt.
Ist mir nicht aufgefallen.

Hab gegooglet und folgende Lösung gefunden:
I've just had the same problem (with Python 2.7 and PIL for this versions, but the solution should work also for 2.6) and the way to solve it is to copy all the registry keys from:

Code: Alles auswählen

HKEY_LOCAL_MACHINE\SOFTWARE\Python
to

Code: Alles auswählen

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python
Ich werd es ausprobieren

Edit: Es gibt garkeine \SOFTWARE\Python in meiner Registry :D
Edit2: Bin auf folgenden Link gestoßen. http://www.lfd.uci.edu/~gohlke/pythonlibs/#pil
Dort gibt es PIL für 64bit Systeme, werde das ausprobieren

========================

PIL-fork-1.1.7.win-amd64-py2.7.‌exe [1.1 MB] [Python 2.7] [64 bit] [Sep 24, 2012]

Hat funktioniert :) Danke für die Hilfe!