Headingmessage

Python


Install a Python module using a Virtual Environment

Create a virtualenv (you only need to do this step once)

boswald.ui@ondemand ~ * virtualenv bcvenv
Using base prefix '/usr'
New python executable in /lfs/boswald.ui/bcvenv/bin/python3.6
Also creating executable in /lfs/boswald.ui/bcvenv/bin/python
Installing setuptools, pip, wheel...done.
boswald.ui@ondemand ~ * 

Activate the virtual environment

boswald.ui@ondemand ~ * source bcvenv/bin/activate
(bcvenv) boswald.ui@ondemand ~ * 

Install any packages you need

(bcvenv) boswald.ui@ondemand ~ * pip3 install bcrypt
Collecting bcrypt
  Using cached bcrypt-4.0.1-cp36-abi3-manylinux_2_28_x86_64.whl (593 kB)
Installing collected packages: bcrypt
Successfully installed bcrypt-4.0.1
(bcvenv) boswald.ui@ondemand ~ * 

Use the installed package

(bcvenv) boswald.ui@ondemand ~ * python
Python 3.6.8 (default, Apr 12 2022, 06:55:39) 
[GCC 8.5.0 20210514 (Red Hat 8.5.0-10)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import bcrypt
>>> 
>>> 

Deactivate the virtual environment when you're done

(bcvenv) boswald.ui@ondemand ~ * deactivate
boswald.ui@ondemand ~ *