Lukas
Lukas

Reputation: 441

How to automatically run a shell script after activation of python virtualenv?

in a virtual python environment called venv I always need to add a variable to my PATH variable. I only want it when venv is activated. Can I create a script and tell my venv to always run it when activating my venv?

Thanks :)

I am using this virtual environment and ubuntu 20.04.

My python version is Python 3.8.2

Upvotes: 0

Views: 252

Answers (1)

phd
phd

Reputation: 94397

Edit your <venv>/bin/activate and add your $PATH. deactivate will automatically remove it because it restores $PATH that activate saved.

Upvotes: 1

Related Questions