Friday, February 18, 2022

python2 virtual environment

The pip installer for python 2.7 can be found here: 

curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py

Verify that the pip2 is installed by looking for it in

$HOME/Library/Python/2.7/bin


To setup the virtual environment in Python2, use virtualenv  


Library/Python/2.7/bin/virtualenv -p $(which python2.7) venv


Activate the virtual environment


source /venv/bin/actiave


Install packages in the virtual environment


python -m pip install lxml jinja2


To exit the virtual environment 


deactivate


If you don't have virtualenv you can install using pip


python -m pip virtualenv --user

No comments: