-
Notifications
You must be signed in to change notification settings - Fork 757
sms tools in Windows
I recommend you to install miniconda. Because you can install mathematic libraries more easily. Miniconda
(You have to choose python2.7).
You need some C++ compiler to build C code inside software/models/utilFunctions_C. We are going to use gcc that comes with mingwpy (only supports Python 2.7)
pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
Compile the files using the code below:
python compileModule.py build_ext --inplace --compiler=mingw32
That's it, if you are lucky and no issues pop up, then enjoy, otherwise go to Option 2 below.
You have to prepare it to compile utilFunctions_C
.
Set up it conforming with your Windows version. Some Windows SDK cause error. Please avoid it by this way. Installing Visual Studio is also ok, but I think you don't want to do it (Because it is very heavy).
(If you installed Visual Studio, I think you can skip this step).
The registory value of Visual Studio home is reffered by vcvars32.bat
or vcvars64.bat
in C:\Program Files\Microsoft Visual Studio 10.0\VC\bin
(the folder name depends on your environment).
You have to set registry value as your bat file script.
For example, In my environment(x86), the script of vcvars32.bat
is like below(at line 77).
:GetVSCommonToolsDirHelper32
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "10.0"') DO (
@if "%%i"=="10.0" (
@SET "VS100COMNTOOLS=%%k"
)
)
@if "%VS100COMNTOOLS%"=="" exit /B 1
@SET "VS100COMNTOOLS=%VS100COMNTOOLS%Common7\Tools\"
@exit /B 0
So I created HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7
and add string 10.0
its value is C:\Program Files\Microsoft Visual Studio 10.0
.
VCVarsQueryRegistry.bat
is in (Visual Studio Home)\Common7\Tools
.
This script needs Microsoft SDKs installed directory. It is set at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\xx
. xx
is SDK version number that you installed (I was v7.1
).
You have to modify VCVarsQueryRegistry.bat
as your installed version.
For example, I changed v7.0A
to v7.1
.
:GetWindowsSdkDirHelper
@for /F "tokens=1,2*" %%i in ('reg query "%1\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A" /v "InstallationFolder"') DO (
@if "%%i"=="InstallationFolder" (
@SET "WindowsSdkDir=%%k"
)
)
@if "%WindowsSdkDir%"=="" exit /B 1
@exit /B 0
Your SDK is newer than based one, so execute set VS90COMNTOOLS=%VSXXXCOMNTOOLS%
before(XXX
is your version).
For example, I execute set VS90COMNTOOLS=%VS100COMNTOOLS%
.
And remove libraries=['m'],
from compileModule.py
. This option is for gcc, so we don't need it.
Then, run compile.
python compileModule.py build_ext --inplace
(at How to use).
I think you will success to compile.
Use conda command to create environment.
conda create -n sms-tools-env ipython numpy matplotlib scipy cython pip
pygame
can not install from conda
. so you have to install it by pip
.
You can download whl
file from below site.
Unofficial Windows Binaries for Python Extension Packages
Activate your environment and install the whl
file.
activate sms-tools-env
pip install pygame‑xxxx.whl
The setup is end! You can run script.
cd software/models_interface
activate sms-tools-env
python models_GUI.py