How to install PIL in Ubuntu 11.04?

前端 未结 4 1792
死守一世寂寞
死守一世寂寞 2021-02-14 16:27

I see this question asked all over the internet, and I\'ve tried following them all, but I still can\'t get PIL to work.

I tried symbolically linking the zlib, jpeg, et

4条回答
  •  后悔当初
    2021-02-14 17:35

    I found it to be a combination of the two above when installing with a requirements.txt on Ubuntu. I'm using Vagrant to run a chef script, and found this approach works best for me:

    First, I use a bash script to setup PIL:

    #!/usr/bin/env bash
    
    sudo apt-get build-dep python-imaging
    sudo ln -s -f /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
    sudo ln -s -f /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
    sudo ln -s -f /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
    

    Next, during the requirements.txt install, the top of the file looks like:

    --allow-external PIL
    --allow-unverified PIL
    
    Django==1.5.4
    PIL==1.1.7
    ...
    

    Of course, this is an unsecured way of doing it, but works for dev and quick builds. For production, it's best to download and verify all packages manually and install them from a local managed repository.

提交回复
热议问题