Works the same but has extra steps to go through to use those and at least for me, virtualenv and wrapper does not give me any great advantage over using what's already built into python.It's very simpleto install and configure virtualenv on rpi5. I had same problem during package installation. I tested the solution on my rpi5.
Follow the given steps.
Step1: Install required packages
sudo apt install python3.11 virtualenv
sudo apt install python3.11 virtualenvwrapper
Step2:
Create .virtualenvs folder in your home directory
mkdir ~/.virtualenvs
Step3: Search for virtualenvwrapper.sh
whereis virtualenvwrapper (This will provide the path to virtualenvwrapper.sh,
in my systems it was located at /usr/share/virtualenvwrapper/virtualenvwrapper.sh)
Step4: Make changes under ~/.bashrc
Open your favourite editor and append the following line in .bashrc file at the end. I am using vim editor for this.
vim ~/.bashrc
export WORKON_HOME=$HOME/.virtualenvs
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.11
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
Save the file and exit
Step5:
source ~/.bashrc
Step6: Create your virtual environment
mkvirtualenv <your env name>
To create a virtual env with python you just cd into whatever folder you want it to exist in and execute the command below, where the XYZ is just the name of the folder that will contain the python bits of your venv:
Code:
python -m venv XYZ
And if you don't want to type that all the time, just create an alias for it.
Statistics: Posted by memjr — Wed May 01, 2024 11:15 pm