简体   繁体   English

在Django模型中使用ImageField的PIL / Pillow的替代方法

[英]Alternative of PIL/Pillow for using ImageField in Django Models

I am setting a django project on Shared hosting server using virtualenv where I don't have root access . 我正在使用virtualenv在共享托管服务器上设置django项目,而我没有root access Also sudo doesn't works.I am using ImageField in models that require PIL/Pillow to be installed.But when I try 此外sudo不works.I现在用ImageField的模型,需要PIL/Pillow当我尝试将installed.But

pip install pillow

I get this error: 我收到此错误:

unable to execute gcc: Permission denied
error: command 'gcc' failed with exit status 1

So is there any alternative available for PIL/Pillow which can be installed without root access and gcc permissions ? 那么,有没有其他可用于PIL/Pillow替代方案,可以在没有root access and gcc permissions情况下安装? (No permissions even in the virtualenv) (即使在virtualenv中也没有权限)

ImageField requires the Pillow library, see here: https://docs.djangoproject.com/en/dev/ref/models/fields/ , no two ways around that. ImageField需要Pillow库,请参见此处: https : //docs.djangoproject.com/en/dev/ref/models/fields/ ,没有两种解决方法。 You will need to install it. 您将需要安装它。 There are several solutions in your case: 您有几种解决方案:

  1. Install/get permission to run gcc on the server 安装/获取在服务器上运行gcc的权限
  2. Compile somewhere else, where the setup is identical and copy the files 在安装相同的其他地方编译并复制文件
  3. Change your code to not use ImageField 更改您的代码以不使用ImageField

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM