Step-by-step guide
Step | Description | Remark |
---|---|---|
1 | Install virtualenv from PyPI:
Comes with
| |
2 | On Windows (only if you want to use powershell): change the ExecutionPolicy of powershell:
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
| |
4 | To use the environment, go to to the folder of the environment (in our example
You may reset your terminal to normal operation with
| |
5 | The 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
)