Edit Your Activation Script
Start by creating a virtual environment for your Python project:
This command creates a virtual environment in your current project folder. You can learn more about working with virtual environments and Python in the Python Engineering course.
After you successfully created a virtual environment, open the
activate script in your favorite text editor. You can find this file inside of the
venv folder that got created by running the command shown above. The relative path of this script is
This Bash script runs every time your
venv gets activated, which makes it a good place to let your computer know which environment variables you would like to have, and which ones to get rid of once you exit the virtual environment.
You will now edit this script and set the variable in Bash that you want in the environment. First, you need to make sure that your virtual environment variables won’t stick around once you deactivated them, so you start by unsetting the environment variable that you haven’t even created yet.