forked from jjcremmers/PyFEM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
156 lines (118 loc) · 5.59 KB
/
install.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
############################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Element Analysis of Solids and Structures' #
# R. de Borst, M.A. Crisfield, J.J.C. Remmers and C.V. Verhoosel #
# John Wiley and Sons, 2012, ISBN 978-0470666449 #
# #
# The code is written by J.J.C. Remmers, C.V. Verhoosel and R. de Borst. #
# #
# The latest stable version can be downloaded from the web-site: #
# http://www.wiley.com/go/deborst #
# #
# A github repository, with the most up to date version of the code, #
# can be found here: #
# https://github.com/jjcremmers/PyFEM #
# #
# The code is open source and intended for educational and scientific #
# purposes only. If you use PyFEM in your research, the developers would #
# be grateful if you could cite the book. #
# #
# Disclaimer: #
# The authors reserve all rights but do not guarantee that the code is #
# free from errors. Furthermore, the authors shall not be liable in any #
# event caused by the use of the program. #
############################################################################
import os,sys,numpy,scipy,matplotlib
#from PyQt5.Qt import PYQT_VERSION_STR
print("\n ===============================================================\n")
# get operating system
osName = sys.platform
# check python version
versionLong = sys.version.split(' ')
version = versionLong[0].split('.')
print(" Python version detected %10s : " %(versionLong[0]) , end=' ' )
if int(version[0]) == 3 and int(version[1]) >= 6:
print(" OK")
elif int(version[0]) == 2:
print(" Please note that PyFEM has been migrated to Python 3.x\n")
print(" Install Pyhon 3.x\n")
else:
print(" Not OK\n\n Please install Python 2.6.x or 2.7.x\n")
# check numpy version
versionLong = numpy.__version__
version = versionLong.split('.')
print(" Numpy version detected %10s : " %(versionLong) , end=' ' )
if int(version[0]) == 1 and int(version[1]) >= 6:
print(" OK")
else:
print(" Not OK\n\n Please install Numpy 1.6.x or higher\n")
# check scipy version
versionLong = scipy.__version__
version = versionLong.split('.')
print(" Scipy version detected %10s : " %(versionLong) , end=' ' )
if int(version[0]) == 0 and int(version[1]) >= 9:
print(" OK")
elif int(version[0]) >= 1 and int(version[1]) >= 0:
print(" OK")
else:
print(" Not OK\n\n Please install Scipy 0.9.x or higher\n")
versionLong = matplotlib.__version__
version = versionLong.split('.')
print(" Matplotlib version detected %10s : " %(versionLong) , end=' ' )
if int(version[0]) >= 1 and int(version[1]) >= 0:
print(" OK")
else:
print(" Not OK\n\n Please install Matplotlib 1.0.x or higher\n")
'''
versionLong = PYQT_VERSION_STR
version = versionLong.split('.')
print(" PyQt version detected %10s : " %(versionLong) , end=' ' )
if int(version[0]) >= 5:
print(" OK")
else:
print(" Not OK\n\n Please install PyQt 5.x or higher\n")
'''
# get current path
path = os.getcwd()
if osName[:5] == "linux":
print("\n LINUX INSTALLATION")
print(" ===============================================================\n")
print(" When using a bash shell, add the following line")
print(" to ~/.bashrc :\n")
print(' export PYTHONPATH="'+path+'"')
print(" alias pyfem='python3 "+path+"/PyFEM.py'\n")
print(" When using csh or tcsh add the following lines to")
print(" ~/.cshrc or ~/.tcshrc :\n")
print(" setenv PYTHONPATH "+path)
print(" alias pyfem 'python3 "+path+"/PyFEM.py'\n")
print(" ===============================================================\n")
print(" Installation succesful")
print(" See the user manual for further instructions.\n\n")
elif osName[:6] == "darwin":
print("\n MAC-OS INSTALLATION")
print(" ===============================================================\n")
print(" Add the following line to ~/.bashrc :\n")
#print(' export PYTHONPATH="'+path+'"')
print(" alias pyfem='python3 "+path+"/PyFEM.py'\n")
print(" ===============================================================\n")
print(" Installation succesful")
print(" See the user manual for further instructions.\n\n")
elif osName[:3] == "win":
batfile = open( 'pyfem.bat' , 'w' )
fexec = sys.executable
if fexec[-5:] == "w.exe":
fexec = fexec[:-5] + ".exe"
print(fexec)
batfile.write(fexec+' '+path+'\PyFEM.py %1')
batfile.close()
print("\n WINDOWS INSTALLATION")
print(" ===============================================================\n")
#print(" Add the following path to PYTHONPATH and PATH:\n")
#print(" ",path,"\n")
print(" ===============================================================\n")
print(" Installation successful!")
print(" See the user manual for instructions.\n\n")
else:
print("Operating system ",osName," not known.")
input(" Press Enter to continue...")