Install pycairo in virtualenv

后端 未结 6 1401
梦毁少年i
梦毁少年i 2020-12-13 09:44

I\'ve tried to install pycairo in a virtualenv to use in a Django project. I\'ve ran the pip install pycairo==1.10.0 command which finds the packag

6条回答
  •  青春惊慌失措
    2020-12-13 09:57

    pycairo currently does not support installation through pip/distutils. The project’s install docs instructs to use either waf or autotools.

    To use pycairo in a virtualenv, you need to:

    • Install pycairo system-wide, preferably through your distribution’s packages
    • Then, either:
      1. Create a virtualenv with the --system-site-packages option or remove the lib/pythonX.Y/no-global-site-packages.txt file after the fact.
      2. Or add a symbolic link to the cairo package (the directory containing _cairo.so). Something like this:
        ln -s /usr/lib/python2.7/site-packages/cairo ./venv/lib/python2.7/site-packages
        

    Of course 1. has the downside that you will not profit from virtualenv’s isolation from other packages installed system-wide.

提交回复
热议问题