简体   繁体   English

如何安装python cairo?

[英]How to install python cairo?

I am new to python3. 我是python3的新手。 I have created the virtual environment. 我已经创建了虚拟环境。 I try to install the pycairo package using pip command. 我尝试使用pip命令安装pycairo软件包。 I need install python cairo. 我需要安装python cairo。 Please see the below info 请查看以下信息

pip install git+http://anongit.freedesktop.org/git/pycairo
Downloading/unpacking git+http://anongit.freedesktop.org/git/pycairo
  Cloning http://anongit.freedesktop.org/git/pycairo to /tmp/pip-0c_foz-build
  Running setup.py egg_info for package from git+http://anongit.freedesktop.org/git/pycairo
    cairo >= 1.10.2  Successful

Installing collected packages: pycairo
  Running setup.py install for pycairo
    cairo >= 1.10.2  Successful
    building 'cairo._cairo' extension
    gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o
    src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2:
    cairo >= 1.10.2  Successful

creating py3cairo.pc

creating src/config.h

running install

running build

running build_ext

building 'cairo._cairo' extension

creating build

creating build/temp.linux-i686-3.2

creating build/temp.linux-i686-3.2/src

gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/python3.2mu -c src/cairomodule.c -o build/temp.linux-i686-3.2/src/cairomodule.o

src/cairomodule.c:22:20: fatal error: Python.h: No such file or directory

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/nyros/Desktop/NewWeb/venv/bin/python3 -c "import setuptools;__file__='/tmp/pip-0c_foz-build/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lo0egc-record/install-record.txt --single-version-externally-managed --install-headers /home/nyros/Desktop/NewWeb/venv/include/site/python3.2 failed with error code 1 in /tmp/pip-0c_foz-build
Storing complete log in /home/nyros/.pip/pip.log

But I got the error. 但是我得到了错误。 Please solve my problem. 请解决我的问题。 Thanks 谢谢

I think this may solve your problem: 我认为这可以解决您的问题:

sudo apt-get install python3-dev

But I cannot guarantee that this will work 100% :-) 但是我不能保证这将100%起作用:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM