Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python';s PIL映像库不工作_Python_Pillow - Fatal编程技术网

Python';s PIL映像库不工作

Python';s PIL映像库不工作,python,pillow,Python,Pillow,我有一个奇怪的错误时,试图使用枕头保存在我的管理图像 文件Models.py: 文件Admin.py 最奇怪的是,当我删除 from PIL.Image import core as _imaging 我用的是旧的,不是旧的。交易是什么?从PIL导入(图像作为核心)与从PIL导入(图像作为核心)不同。还不完全清楚哪个代码出错。。。如果直接在运行django的shell/命令行中运行python,是否可以通过手动导入来重新创建错误?如果是这样,您可以在[4]中发布(您正在键入的内容以及由此产生的

我有一个奇怪的错误时,试图使用枕头保存在我的管理图像

文件Models.py: 文件Admin.py 最奇怪的是,当我删除

from PIL.Image import core as _imaging

我用的是旧的,不是旧的。交易是什么?

从PIL导入(图像作为核心)
与从PIL导入(图像作为核心)不同。还不完全清楚哪个代码出错。。。如果直接在运行django的shell/命令行中运行python,是否可以通过手动导入来重新创建错误?如果是这样,您可以在[4]中发布(您正在键入的内容以及由此产生的错误和stacktrace)?
:来自PIL导入映像----------------------------------------------------------------------导入错误回溯(最近一次调用)--->1来自PIL导入映像/usr/local/lib/python2.7/dist-packages/PIL/Image.py in()--->63来自PIL导入映像作为core 64如果是PILLOW\u版本!=getattr(core,'Pizzle_VERSION',None):65(该_ImagingExtension是为另一个版本而构建的)导入错误:无法导入名称_imaging
最糟糕的部分是,我完全按照教程中的要求执行了…我已经卸载了PIL,我只是双重检查了一下。当我从PIL注释掉覆盖的
时,我得到了相同的错误。图像导入核心为_imaging
重复?
from django.db import models
from django.contrib.auth.models import User
from string import join
import os
from PIL.Image import core as _imaging
from PIL import Image as PImage
from my_site.settings import MEDIA_ROOT

class Image(models.Model):
    title       = models.CharField(max_length=60, blank=True, null=True)
    image       = models.FileField(upload_to="images/")
    created     = models.DateTimeField(auto_now_add=True)
    width       = models.IntegerField(blank=True, null=True)
    height      = models.IntegerField(blank=True, null=True)
    category    = models.ForeignKey(Category, blank=True, null=True)
    def save(self, *args, **kwargs):
        super(Image, self).save(*args, **kwargs)
        im = PImage.open(os.path.join(MEDIA_ROOT, self.image.name))
        self.width, self.height = im.size
        super(Image, self).save(*args, **kwargs)
class GenericImageAdmin(admin.ModelAdmin):
    list_display    = ["__unicode__", "title", "created", "thumbnail"]

    def save_model(self, request, obj, form, change):
        obj.user = request.user
        obj.save()

admin.site.register(GenericImage, GenericImageAdmin)
from PIL.Image import core as _imaging