Skip to content

Commit 5fafb4a

Browse files
authored
Merge pull request #71 from naveen521kk/pycairo-install
Pycairo install Made Easy Using single Command
2 parents a6b090f + 9280c23 commit 5fafb4a

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,19 @@ Before installing `manim-community`, there are some additional dependencies that
5656
> win_amd64 corresponds to 64-bit machines, win32 corresponds to 32-bit machines
5757
5858
3. Open up your command prompt by hitting the Win key and typing `cmd`
59+
5960
4. Enter the directory where you install cairo by typing `cd C:\path\to\cairo` with the path being where you downloaded the `.whl` file
61+
6062
5. Finally, run `pip3 install (cairo-file).whl`, where the file the appropriate name of the `.whl` file.
6163

64+
6. Alternatively, Running the command below installs pycairo. This needs to be an elevated command prompt like Powershell.
65+
66+
```powershell
67+
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/ManimCommunity/manim/master/scripts/pycairoInstall.py -UseBasicParsing).Content | py -3
68+
```
69+
70+
71+
6272
#### FFmpeg Installation
6373
1. To install `ffmpeg` and add it to your PATH, install [Chocolatey](https://chocolatey.org/) and run `choco install ffmpeg`
6474
2. You can check you did it right by running `refreshenv` to update your environment variable and running `ffmpeg`

Scripts/pycairoInstall.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import platform
2+
import os
3+
import sys
4+
import urllib.request
5+
6+
if 'Windows' in platform.system():
7+
#In case the python version is 3.6 and the system is 32-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
8+
if sys.version[:3]=='3.6' and platform.machine()=='x86':
9+
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp36-cp36m-win32.whl", "pycairo-1.19.1-cp36-cp36m-win32.whl")
10+
os.system("pip install pycairo-1.19.1-cp36-cp36m-win32.whl")
11+
os.remove("pycairo-1.19.1-cp37-cp37m-win32.whl")
12+
13+
#In case the python version is 3.6 and the system is 64-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
14+
elif sys.version[:3]=='3.6' and platform.machine()=='AMD64':
15+
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp36-cp36m-win_amd64.whl", "pycairo-1.19.1-cp36-cp36m-win_amd64.whl")
16+
print("Sucessfully downloaded Cairo for your system")
17+
print("Installing Cairo")
18+
os.system("pip install pycairo-1.19.1-cp36-cp36m-win_amd64.whl")
19+
os.remove("pycairo-1.19.1-cp36-cp36m-win_amd64.whl")
20+
21+
#In case the python version is 3.7 and the system is 32-bit, try pycairo‑1.19.1‑cp37‑cp37m‑win32.whl version of cairo
22+
elif sys.version[:3]=='3.7' and platform.machine()=='x86':
23+
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp37-cp37m-win32.whl", "pycairo-1.19.1-cp37-cp37m-win32.whl")
24+
print("Sucessfully downloaded Cairo for your system")
25+
print("Installing Cairo")
26+
os.system("pip install pycairo-1.19.1-cp37-cp37m-win32.whl")
27+
os.remove("pycairo-1.19.1-cp37-cp37m-win32.whl")
28+
29+
#In case the python version is 3.7 and the system is AMD64, try pycairo-1.19.1-cp37-cp37m-win_amd64.whl version of cairo
30+
elif sys.version[:3]=='3.7' and platform.machine()=='AMD64':
31+
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp37-cp37m-win_amd64.whl", "pycairo-1.19.1-cp37-cp37m-win_amd64.whl")
32+
print("Sucessfully downloaded Cairo for your system")
33+
print("Installing Cairo")
34+
os.system("pip install pycairo-1.19.1-cp37-cp37m-win_amd64.whl")
35+
os.remove("pycairo-1.19.1-cp37-cp37m-win_amd64.whl")
36+
37+
#In case the python version is 3.8 and the system is 32-bit, try pycairo-1.19.1-cp38-cp38-win32.whl version of cairo
38+
elif sys.version[:3]=='3.8' and platform.machine()=='x86':
39+
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp38-cp38-win32.whl", "pycairo-1.19.1-cp38-cp38-win32.whl")
40+
print("Sucessfully downloaded Cairo for your system")
41+
print("Installing Cairo")
42+
os.system("pip install pycairo-1.19.1-cp38-cp38-win32.whl")
43+
os.remove("pycairo-1.19.1-cp38-cp38-win32.whl")
44+
45+
#In case the python version is 3.8 and the system is AMD64, try pycairo-1.19.1-cp38-cp38-win_amd64.whl version of cairo
46+
elif sys.version[:3]=='3.8' and platform.machine()=='AMD64':
47+
urllib.request.urlretrieve("https://download.lfd.uci.edu/pythonlibs/s2jqpv5t/pycairo-1.19.1-cp38-cp38-win_amd64.whl", "pycairo-1.19.1-cp38-cp38-win_amd64.whl")
48+
print("Sucessfully downloaded Cairo for your system")
49+
print("Installing Cairo")
50+
os.system("pip install pycairo-1.19.1-cp38-cp38-win_amd64.whl")
51+
os.remove("pycairo-1.19.1-cp38-cp38-win_amd64.whl")

0 commit comments

Comments
 (0)