Virtual environment on Windows
Revision as of 08:48, 30 January 2024 by Ville Valtavirta (talk | contribs) (→Installing and using the virtual environment)
Get Python 3.8 from the Python website (executable installer for Windows). During installation, tick the box for "add Python 3.8 to PATH" and take note of the installation location.
Also choose "Disable path length limit" if prompted.
Check Python path
Open a command prompt and run
python
>>> import sys >>> print(sys.executable)
and make sure that the location of the Python executable is the same you noted down during the installation.
Installing and using the virtual environment
Open a command prompt and run
python3.8 -m pip install virtualenv python3.8 -m pip install virtualenvwrapper-win
(Close the command prompt and open a new one.)
mkvirtualenv kraken python3.8 -m virtualenv kraken
After this the following commands should work
workon kraken <... do some work in the environment ...> deactivate
Also see
echo %WORKON_HOME%
to see, where the virtual environments are stored.
The batch file
%WORKON_HOME%\kraken\Scripts\activate.bat
can be edited to add new environment variables at its end:
set "TRACEP5_EXE_PATH=C:\TRACE-V50P5-Exe\Executables\trace-V50p5-windows-msvs2017-ivf-x86-Release.exe" etc.
Installing dependencies
Dependencies can be installed using
pip install --upgrade numpy pip install --upgrade scipy pip install --upgrade matplotlib pip install --upgrade serpenttools
in the kraken environment.