forked from Pyomo/pyomo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_pyomo.py
46 lines (39 loc) · 1.23 KB
/
get_pyomo.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
# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright (c) 2008-2022
# National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC, the U.S. Government retains certain
# rights in this software.
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________
#
# A script to install Pyomo and its dependencies (ply)
#
import sys
try:
import pip
pip_version = pip.__version__.split('.')
for i, s in enumerate(pip_version):
try:
pip_version[i] = int(s)
except:
pass
pip_version = tuple(pip_version)
except ImportError:
print("You must have 'pip' installed to run this script.")
raise SystemExit
print("Installing Pyomo ...")
cmd = ['install']
# Disable the PIP download cache
if pip_version[0] >= 6:
cmd.append('--no-cache-dir')
else:
cmd.append('--download-cache')
cmd.append('')
# Allow the user to provide extra options
cmd.extend(sys.argv[1:])
# install Pyomo
cmd.append('Pyomo')
pip.main(cmd)