forked from rougier/matplotlib-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-installation.py
59 lines (53 loc) · 1.44 KB
/
check-installation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Nicolas P. Rougier. All Rights Reserved.
# Distributed under the (new) BSD License.
# -----------------------------------------------------------------------------
from distutils.version import LooseVersion
# Check for python
import sys
if sys.version_info <= (3,0):
print("This tutorial requires Python 3\n")
sys.exit()
# Check for numpy
try:
import numpy as np
except:
print("This tutorial requires numpy\n")
sys.exit()
print("Check for numpy: ", end="")
if LooseVersion(np.__version__) < LooseVersion("1.0"):
print("numpy too old (< 1.0)\n")
sys.exit()
else:
print("ok")
# Check for matplotlib
try:
import matplotlib as mpl
except:
print("This tutorial requires matplotib\n")
sys.exit()
print("Check for matplotlib: ", end="")
if LooseVersion(mpl.__version__) < LooseVersion("1.5"):
print("matplotlib too old (< 1.5)\n")
sys.exit()
else:
print("ok")
# Check for basemap
try:
import mpl_toolkits.basemap as basemap
except:
print("This tutorial requires basemap\n")
sys.exit()
print("Check for basemap: ", end="")
if LooseVersion(basemap.__version__) < LooseVersion("1.0"):
print("basemape is too old (< 1.0) \n")
sys.exit()
else:
print("ok")
# Check for urllib
try:
import urllib
except:
print("This tutorial requires urllib")
else:
print("Check for urllib: ok")