2014-04-15 42 views
3

我嘗試了安裝django-cms的所有過程,之後當我嘗試運行演示頁時出現以下錯誤。運行django-cms演示頁面時出錯

(djvenv2)[email protected]:~/workspace/projects/djvenv$ pip freeze 
Django==1.6.2 
PIL==1.1.7 
Pillow==2.4.0 
South==0.8.4 
argparse==1.2.1 
dj-database-url==0.3.0 
django-classy-tags==0.5.1 
django-cms==3.0 
django-mptt==0.6.0 
django-sekizai==0.7 
djangocms-admin-style==0.2.2 
djangocms-installer==0.4.1 
html5lib==0.999 
six==1.6.1 
wsgiref==0.1.2 

(djvenv2)[email protected]:~/workspace/projects/djvenv$ djangocms -p . my_demo 
Database configuration (in URL format) [default sqlite://localhost/project.db]: 
django CMS version (choices: 2.4, 3.0, stable, develop) [default stable]: 
Django version (choices: 1.4, 1.5, 1.6, stable) [default 1.5]: 
Activate Django I18N/L10N setting (choices: yes, no) [default yes]: 
Install and configure reversion support (choices: yes, no) [default yes]: 
Languages to enable. Option can be provided multiple times, or as a comma separated list: en 
Optional default time zone [default America/Chicago]: 
Activate Django timezone support (choices: yes, no) [default yes]: 
Activate CMS permission management (choices: yes, no) [default yes]: 
Use Twitter Bootstrap Theme (choices: yes, no) [default no]: yes 
Load a starting page with examples after installation (choices: yes, no) [default no]: yes 
INFO: Starting new HTTPS connection (1): pypi.python.org 
Traceback (most recent call last): 
    File "/home/shan/workspace/venv/djvenv2/bin/djangocms", line 9, in <module> 
    load_entry_point('djangocms-installer==0.4.1', 'console_scripts', 'djangocms')() 
    File "/home/shan/workspace/venv/djvenv2/local/lib/python2.7/site-packages/djangocms_installer/main.py", line 24, in execute 
    install.check_install(config_data) 
    File "/home/shan/workspace/venv/djvenv2/local/lib/python2.7/site-packages/djangocms_installer/install/__init__.py", line 52, in check_install 
    raise EnvironmentError("\n".join(errors)) 
EnvironmentError: Pillow is not compiled with JPEG support, see 'Libraries installation issues' documentation section. 

回答

20

添加JPEG支持枕頭,在Ubuntu,你可以做到以下幾點:

sudo apt-get install libjpeg-dev libfreetype6-dev zlib1g-dev 

# Link the libraries for Pillow to find them: 

sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/ 
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/ 
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/ 

# reinstall Pillow (In case you have Pillow already installed) 
pip install --upgrade --force-reinstall pillow 
+2

下面它仍然拋出關於pil和jpeg事物的相同錯誤...所以我點卸載枕頭,再次點擊安裝枕頭...其中解決了問題 –

+0

你好。這個命令是使用'sudo pip install --upgrade pillow' –

+2

for centos user just install'libjpeg-turbo-devel libpng-devel zlib-devel' – xdays

1

我面對下我BitNami LAMP虛擬機同樣的問題,不能從連接丟失的文件解決了它枕頭。最後,我解決了這個問題:

第一,找到的lib

(venv)...$ find 2>/dev/null/-name libz.so 
/opt/bitnami/common/lib/libz.so 

現在加上lib目錄到點子

(venv)...$ pip install --global-option=build_ext --global-option="-L/opt/bitnami/common/lib" --global-option="-I/opt/bitnami/common/include" --upgrade --force-reinstall pillow 

它的工作原理:

-------------------------------------------------------------------- 
PIL SETUP SUMMARY 
-------------------------------------------------------------------- 
version  Pillow 2.7.0 
platform  linux2 2.7.6 (default, Mar 22 2014, 22:59:56) 
      [GCC 4.8.2] 
-------------------------------------------------------------------- 
*** TKINTER support not available 
--- JPEG support available 
*** OPENJPEG (JPEG2000) support not available 
--- ZLIB (PNG/ZIP) support available 
--- LIBTIFF support available 
--- FREETYPE2 support available 
*** LITTLECMS2 support not available 
*** WEBP support not available 
*** WEBPMUX support not available 
-------------------------------------------------------------------- 

也看到python pip specify a library directory and an include directory

2

重裝枕頭其實,我發現這裏的選擇的解決方案是有很大的幫助。我還發現,djangcms安裝程序需要特定版本的Pillow,導致它無論如何都無法拾取JPEG模塊。在撰寫本文時,它想要Pillow==2.8.0,但pip --upgrade安裝的最新版本是2.9.x.我跑了pip install --no-cache-dir --upgrade --force-reinstall pillow==2.8.0,似乎滿足了djangocms安裝程序的要求,因此它會保持JPEG兼容性。

您可以通過在virtualenv中打開python shell來驗證是否安裝了JPEG支持。

from PIL import Image 

i = Image.open('/path/to/a.jpg') 
i.load() 

你要麼得到一個處理加載的圖像或異常,如果沒有JPEG的支持。

所以pip成功安裝了JPEG支持的Pillow軟件包,但只要我運行djangocms安裝程序,它就會用沒有JPEG支持的Pillow軟件包替換它。您需要匹配djangocms安裝程序所需的Pillow版本。我不知道配置在哪裏,但是在安裝失敗之後,您可以用pip freezepip list找出它。

希望這可以幫助別人。

+0

這解決了我的問題 – Shawn