的另一個版本內置我得到的錯誤:PIL:導入錯誤:將_imaging擴展是爲枕頭或PIL
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-0f6709e38f49> in <module>()
----> 1 from PIL import Image
C:\Anaconda\lib\site-packages\PIL\Image.py in <module>()
61 from PIL import _imaging as core
62 if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
---> 63 raise ImportError("The _imaging extension was built for another "
64 " version of Pillow or PIL")
65
ImportError: The _imaging extension was built for another version of Pillow or PIL
每當我嘗試使用PIL庫。我試圖加載和一堆.gif注意的的工作,我嘗試了,如下:
from PIL import Image
嘗試了不同的方法,通過與SciPy的:
import scipy.ndimage as spnd
os.chdir('C:\\WeatherSink\\data\\')
spnd.imread('2014-11-03-0645.gif')
不符合:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-23c383b79646> in <module>()
1 os.chdir('C:\\WeatherSink\\data\\')
----> 2 spnd.imread('2014-11-03-0645.gif')
C:\Anaconda\lib\site-packages\scipy\ndimage\io.pyc in imread(fname, flatten, mode)
36 from PIL import Image
37 except ImportError:
---> 38 raise ImportError("Could not import the Python Imaging Library (PIL)"
39 " required to load image files. Please refer to"
40 " http://pypi.python.org/pypi/PIL/ for installation"
ImportError: Could not import the Python Imaging Library (PIL) required to load image files. Please refer to http://pypi.python.org/pypi/PIL/ for installation instructions.
第一種方法指導我安裝PIL版本。我嘗試模擬getattr(...),並返回None。所以我並不感到驚訝,因爲它不起作用。 但有誰知道如何'修復'的錯誤?
我在win7上運行,通過conda管理python2.7。我試圖刪除並重新安裝這些軟件包,而不會改變輸出。
非常感謝幫助。
首先猜測你是否安裝了多個版本的PIL或Pillow,並且可能在不同的環境下安裝。找到他們全部,全部卸載它們,然後重新安裝一個新的枕頭。 – Hugo 2014-11-04 10:14:13