Step-by-step guide

StepDescriptionRemark
1

Install virtualenv from PyPI:

pip -install virutalenv

Comes with

  • appdirs 1.4.4
  • distlib 0.3.1
  • filelock 3.0.12
  • six 1.15.0

2

On Windows (only if you want to use powershell):

change the ExecutionPolicy of powershell:

  • Open powershell as administrator
  • Enter Set-ExecutionPolicy RemoteSigned

Otherwise the activate script for a virtual environment will not be executed.

Note: using classical "cmd", this step is not necessary


3

To create a virtual environment flecsimo_test:

  • change to the directory, that will contain the virtual environment folder, e.g. cd <...>\\Projects, where <...> denotes any path of your choice.
  • create the virtualenv by
        virtualenv flecsimo_test
    or (if you have not assigned .py files to the python interpreter:
        python virtualenv flecsimo_test

4

To use the environment, go to to the folder of the environment (in our example flecsimo_test) and activate it by

    .\Scripts\activate

You may reset your terminal to normal operation with

    .\Scripts\deactivate


5The environment may be removed completely by simply deleting the home directory (e.g. flecsimo_test) and all sub-directories of the environment,


On paths

Virtualenv adapts the python path, e.g. if your normal path is

   <...>\\Python\\Python38\\python38.zip,
   <...>\\Python\\Python38\\DLLs,
   <...>\\Python\\Python38\\lib,
   <...>\\Python\\Python38',
   <...>\\Python\\Python38\\lib\\site-packages

activating a virtualenv in <...>\\Projects\\flecsimo_test, will change to

   <...>\\Projects\\flecsimo_test\\Scripts\\python38.zip,
   <...
>\\python\\python38\\DLLs,
   <...>
\\python\\python38\\lib,
   <...>\\python\\python38,
   <...>\\Projects\\flecsimo_test,
   <...>\\Projects\\flecsimo_test\\lib\\site-packages'

On python path

Activating a virtualenv will automatically allow to import the flecsimo libraries into your code, e.g.

import flecsimo.base.msg
from flecsimo.base.connect import Connector

will work, but starting a script in Scripts will require eiter to set PYTHONPATH or to start the script directly with the python interpreter (e. g. python Scripts\site-control)