Vishnu Prasad Ответов: 0

Python pillow-SIMD lib issue-AH01215: importerror: нет модуля с именем PIL: - скрипт Python не может распознать PIL при запуске из конфигурации apache2


What did you do?

I have configured in apache httpd.conf - enabling of mod_cgi.so and httpd-vhosts.conf.

In httpd-vhosts have following conifguration. Basically am trying to capture all /images/ pattern, read have that process using a index.py script and return back as image/jpeg content.

<VirtualHost *:80>
ServerAdmin abc.xyz@bbc.com
ServerName www.groc-example.com
ServerAlias groc-example.com
Alias "/images/" "/var/www/images/"
DirectoryIndex index.py
ErrorLog "/private/var/log/apache2/groc-example-images-error_log"
CustomLog "/private/var/log/apache2/groc-access-log" common
<Directory "/var/www/images/">
Options +ExecCGI
Allow from all
Require all granted
ForceType text/html
AddHandler cgi-script .py

In the index.py am just trying to start the script by trying to import the image. It doenst work i.e. recognize at all. The same import of PIL works from python2/python3 interface in spyder or pycharm or commandlines.

If I remove PIL import statement, the html works or prints out to browser.

#! /usr/bin/env python
from PIL import Image

print ""
print "hello world"
print "--"
print ""

What did you expect to happen?

python script to recognize PIL but it doesnt recognize. I have uninstalled PIL-SIMD multiple times and reinstalled but it isnt working.
Though I have both python2 and python3, default am using python2 and so is apache CGI interface.

What actually happened?

I capture following error in apache logs.
AH01215: from PIL import Image: /var/www/images/index.py
AH01215: ImportError: No module named PIL: /var/www/images/index.py

What versions of Pillow and Python are you using?

Python 2.7.12
Pillow-SIMD
Pillow-SIMD (4.0.0.post0)

Please help if this wont resolve, I have to completely move away from python.


Что я уже пробовал:

Я удалил и переустановил pillow-simd несколько раз и перепробовал все возможные вещи...только когда через обработчик в apache эта проблема сохраняется.

0 Ответов