-
Notifications
You must be signed in to change notification settings - Fork 0
π Loading VirtualEnv in Spartan
rNLKJA edited this page Mar 29, 2023
·
2 revisions
Before loading virtualenv module, you need to login spartan.
- load a python module which contains a virtualenv builtin.
# the example use python3.9.6, therefore as a result, virtual env will have a python version 3.9.6
module load python/3.9.6
python3 --version # this should return Python 3.9.6
# check virtualenv existence
which virtualenv
# output: /usr/local/easybuild-2019/easybuild/software/compiler/gcccore/11.2.0/python/3.9.6/bin/virtualenv- create a virtual env
# create a virtualenv folder in user root directory
mkdir ~/virtualenv
# move to virtualenv
cd ~/virtualenv
# create a virtualenv use current python version
virtualenv python3.9.6 # a python folder named python3.9.6 will present in virtualenv folder- activate virtualenv python3.9.6
source ~/virtualenv/python3.9.6/bin/activateAfter activate a virtual environment, the terminal should be like this:

In your virtualenv, install any wanted/required packages using pip command.
To deactivate a virtualenv, simply use the command: deactivate.