Home  >  Q&A  >  body text

python - ubuntu的virtualenv下安装PIL的依赖包问题

在virtualenv下制作验证码时用到PIL,ubuntu的64位原系统下用apt-get install imagemagick就可以了,但在virtualenv下怎么都不行。在安装前阅读readme知道需要的前置依赖包。该装的都装了(无论手动还是apt-get),明确指定位置(图右侧,None为搜索常见位置)。

反复检测,然后始终在这两个地方出错,详情见图片的左侧jpeg,zlib都不ok,然而奇怪的是在原系统下全部都不ok照样顺利使用PIL,virtualenv当然也碰过运气,死活不行。

右侧为搜索常见的文件位置设为None,我在zlib和jpeg把所有whereis,find pkg-configXXXX等方法的位置都填过,换过好几种格式都无果,最后又写回None当然也是不行的。新手自学陷坑,弄了5小时试过把本地环境dist-packages手动迁移什么都试过,建软连接到/usr/lib无果,实在是没办法了。

求破,求解决办法,非常感谢!

PHPzPHPz2712 days ago545

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 17:48:53

    1. Confirm that the python running in the (venv) environment is the python of venv, not the system. You can use os.path

    2. Confirm that the JPEG and ZLIB libraries are installed correctly
      Also, I hope this article can help you

    https://darrenma.wordpress.com/2012/07/13/installing-pil-into-a-virtualenv-properly-in-ubuntu/

    reply
    0
  • Cancelreply