【问题标题】:ImportError: The _imaging C module is not installed? PIL Python3ImportError:_imaging C 模块没有安装? PIL Python3
【发布时间】:2013-04-17 10:00:28
【问题描述】:
root@syscomp1:~# cd Pillow-master
root@syscomp1:~/Pillow-master# python3 selftest.py
Traceback (most recent call last):
  File "selftest.py", line 8, in <module>
    from PIL import Image
  File "./PIL/Image.py", line 155, in <module>
    if hasattr(core, 'DEFAULT_STRATEGY'):
  File "./PIL/Image.py", line 39, in __getattr__
    raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
root@syscomp1:~/Pillow-master#

这是我安装 PIL 之前的步骤

sudo apt-get install python-pip python-dev build-essential 
sudo pip install --upgrade pip 
sudo pip install --upgrade virtualenv 
sudo aptitude install python3-setuptools
sudo easy_install3 pip
sudo apt-get install python3-dev
download the Pillow-master.zip
wget https://github.com/python-imaging/Pillow/archive/master.zip
go to downloaded directory and,
sudo unzip master.zip
sudo apt-get install libjpeg62-dev //must install this
sudo apt-get install zlib1g-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install liblcms1-dev
python3 setup.py build_ext -i

但是The _imaging C module is not installed 出错,为什么?

【问题讨论】:

  • 你能看到编译好的模块是否真的在身边吗?只需在主目录中查找 so 文件:ls *.so。如果你找不到它们,你一定是在构建扩展的过程中出错了,所以接下来寻找(只需重新运行构建)。
  • @Evert 你的意思是python3 setup.py build 又是什么?不起作用,我已经尝试了很多次这个命令
  • 但是有错误信息吗?并检查另一件事:是否有任何 .so 文件?

标签: python python-imaging-library


【解决方案1】:

看起来像 setup.py 中的 Python 2 打印语句:

  Downloading from URL http://effbot.org/media/downloads/PIL-1.1.7.tar.gz (from http://effbot.org/downloads/)
  Running setup.py egg_info for package pil

    Traceback (most recent call last):

      File "<string>", line 16, in <module>

      File "<pyenv>/build/pil/setup.py", line 182

        print "--- using Tcl/Tk libraries at", TCL_ROOT

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-01-05
    • 2012-03-22
    • 1970-01-01
    • 2012-02-10
    • 1970-01-01
    • 2020-08-13
    相关资源
    最近更新 更多