| 1 |
=============== |
| 2 |
Getting Started |
| 3 |
=============== |
| 4 |
|
| 5 |
Installation: |
| 6 |
|
| 7 |
* ``pip3 install pycairo`` |
| 8 |
|
| 9 |
Installing Pycairo requires pkg-config and cairo including its headers. Here |
| 10 |
are some examples on how to install those for some platforms: |
| 11 |
|
| 12 |
* Ubuntu/Debian: ``sudo apt install libcairo2-dev pkg-config python3-dev`` |
| 13 |
* macOS/Homebrew: ``brew install cairo pkg-config`` |
| 14 |
* Arch Linux: ``sudo pacman -S cairo pkgconf`` |
| 15 |
* Fedora: ``sudo dnf install cairo-devel pkg-config python3-devel`` |
| 16 |
* openSUSE: ``sudo zypper install cairo-devel pkg-config python3-devel`` |
| 17 |
|
| 18 |
To verify that the installation works run the following Python code: |
| 19 |
|
| 20 |
.. code:: python |
| 21 |
|
| 22 |
import cairo |
| 23 |
|
| 24 |
FAQ |
| 25 |
--- |
| 26 |
|
| 27 |
**My cairo import is failing after installing it with pip** |
| 28 |
|
| 29 |
pip caches Python wheels from earlier installs by default and if the cairo |
| 30 |
version the wheel was built against ist different from the one you run against |
| 31 |
then this might lead to errors. You can force pip to re-build and re-install |
| 32 |
pycairo in this case: |
| 33 |
|
| 34 |
:: |
| 35 |
|
| 36 |
pip3 install --force-reinstall --no-cache-dir pycairo |