python 3 activate venv code example
Example 1: how to set up python virtual environment
# install the package virtualenv
pip install virtualenv
# setup envioronment for Data engineering pipeline
virtualenv dataengineer_pipeline
# if using python >= 3.3
python -m venv dataengineer_pipeline
# start the environment in linux using
dataengineer_pipeline/bin/activate
# or in windows
dataengineer_pipeline\Scripts\activate.bat
# when you are done using the environment, type in the command below
deactivate
Example 2: virtual environment python
### VIRTUAL ENVIRONMENT
pip install virtualenv
virtualenv pas # write the folder name
.\foldername\Scripts\activate # to activate the virtual environment
pip freeze # to get all the modules in the base interpretor / virtual env
pip freeze > requirements.txt # to set the modules and their versions in the requirement file
pip install -r requirements.txt # to install all the modules with their respected versions in the virtual env
virtualenv --system-site-packages-foldername # this creates virtual env with all the modules and versions that are preinstalled on base python interpretor
deactivate # to come out of the virtual env
Example 3: activate venv
venv\Scripts\activate.bat
Example 4: python virtual env
$ export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7