Buildin

setenv PYTHONUSERBASE /data/xxx

pip install --user <package_name>

Virtualenv

Reference:

  1. About pip install —-user
bash
pip install --user virtualenv

export PATH=/home/zoryz2/.local/bin:$PATH
virtualenv -p python3 .env       # Create a virtual environment (python3)

source .env/bin/activate         # Activate the virtual environment everytime

# pip install conda
pip install -r requirements.txt  # Install dependencies
# Note that this does NOT install TensorFlow or PyTorch, 
# which you need to do yourself.

# Work on the assignment for a while ...
# ... and when you're done:
deactivate                       # Exit the virtual environment

################### anotherone ############

python3 -m venv .venv
source .venv/bin/activate # run this everytime
# bash
# source .env/bin/activate
pip install -r requirements.txt

Conda env

# option 1
conda env export > ENV1.yaml # export
conda env create -f ENV1.yaml # import
conda env update --file ENV1.yaml --prune # import by update

# option 2
pipreqs path/to/project # make requirements.txt by scanning