forked from scitools-classroom/scipy-2018-cartopy-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_env.py
More file actions
45 lines (37 loc) · 888 Bytes
/
check_env.py
File metadata and controls
45 lines (37 loc) · 888 Bytes
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
"""
Test import of packages for the tutorial
"""
from __future__ import print_function
import importlib
import sys
def version(pkg):
try:
mod = importlib.import_module(pkg)
print(OK, '%s version %s' % (pkg, mod.__version__))
except ImportError:
print(FAIL, '%s not installed' % pkg)
try:
import curses
curses.setupterm()
assert curses.tigetnum("colors") > 2
OK = "\x1b[1;%dm[ OK ]\x1b[0m" % (30 + curses.COLOR_GREEN)
FAIL = "\x1b[1;%dm[FAIL]\x1b[0m" % (30 + curses.COLOR_RED)
except:
OK = '[ OK ]'
FAIL = '[FAIL]'
print('Using python in', sys.prefix)
print(sys.version)
print()
print('Required packages:')
version('cartopy')
version('folium')
version('fiona')
version('geopandas')
version('iris')
version('matplotlib')
version('notebook')
version('numpy')
version('skimage')
version('shapely')
version('xarray')
print()