Keep your Python for yourself
Many times we want to use some Python utilities like black
or newer versions of pip
. But we don't necessarily 'contaminate' our OS or our other virtual environments.
A suggestion is to use a virtual environment and load it on your login without changing your shell prompt (PS1). Here is how I do on my Ubuntu.
First, you have to make sure you have the basic development packages and Python modules:
$ sudo apt install -y \
build-essential \
python3-dev \
python3-pip \
python3-venv
Then you can create your personal Python virtual environment
$ python -m venv .venv
Now you just need to add to your own .bashrc
script the following lines
export VIRTUAL_ENV_DISABLE_PROMPT=1
source ~/.venv/bin/activate
Now after reloading your .bashrc
file or log out and log in again, all the Python commands will point to the ones on your home directory.