Modifications to sys.path only apply for the life of that Python interpreter. If you want to do it permanently you need to modify the PYTHONPATH environment variable:

PYTHONPATH="/Me/Documents/mydir:$PYTHONPATH"
export PYTHONPATH

Note that PATH is the system path for executables, which is completely separate.

**You can write the above in ~/.bash_profile and the source it using source ~/.bash_profile

Answer from Matthew Flaschen on Stack Overflow
🌐
Great Learning
mygreatlearning.com › blog › it/software development › how to add python to path?
How To Add Python To Path?
November 15, 2024 - Windows: Select the "Path" variable and click "Edit." Then click "New" and add the path to your Python installation directory. Click "OK" to save. macOS and Linux: - Use a text editor like Nano to open the system environment file.
Discussions

Python's path on MacOS
Pyenv is going to do a lot to help you manage the various Python installs, and you can install it with Brew: https://formulae.brew.sh/formula/pyenv More on reddit.com
🌐 r/learnpython
9
4
February 25, 2024
Python's path on MacOS
Just add the directory where you installed python to your PATH. More on reddit.com
🌐 r/MacOS
10
1
February 25, 2024
How to set up python on a new Mac?
The fact that there's like 4 different answers including some that contradict the other is why programming is shit for beginners. More on reddit.com
🌐 r/learnpython
29
11
December 17, 2024
Pycharm environment variables
That's an entirely different environment. Do you want to set system-wide environmental variables? How you do that will depend on your OS. In Windows, press start and type "environmental variables" and you can set them in there. More on reddit.com
🌐 r/Python
10
2
July 15, 2017
🌐
Mac Install Guide
mac.install.guide › python › path
Mac Python PATH · Mac Install Guide
June 5, 2024 - Find the Python PATH on Mac. How to add Python to Mac PATH. Set the Mac PATH for Python. Fix errors with the Mac PATH environment variable for Python.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to set environment variables in macos
How to Set Environment Variables in MacOS | phoenixNAP KB
January 27, 2025 - Note: If you want to display the complete list of shell variables, use the set command. If you want to display the value of any specific environment variable, use the echo command: ... For example, to check the value of the PATH variable which stores a list of directories with executable files, use the echo command: ... Note: Always use the $ prefix when specifying a variable name. The value you assign to a temporary environment variable only lasts until you close the terminal session.
🌐
Opensource.com
opensource.com › article › 19 › 5 › python-3-default-mac
The right and wrong way to set Python 3 as default on a Mac | Opensource.com
You do not want the Mac OS X 'default Python' to be 'python3.' You want to never care about default Python." How do we stop caring about the default? Moshe recommends using pyenv to manage Python environments (for a deeper dive on configuring pyenv, see this article).
🌐
Educative
educative.io › answers › how-to-add-python-to-the-path-variable-in-mac
How to add Python to the PATH variable in Mac
The complete path of the Python (or Python3) UNIX executable can be added (for OS X 10.8 Mountain Lion and up) by: Opening the Terminal and entering the command: sudo nano /etc/paths.
🌐
The Hitchhiker's Guide to Python
docs.python-guide.org › starting › install3 › osx
Installing Python 3 on Mac OS X — The Hitchhiker's Guide to Python
The script will explain what changes it will make and prompt you before the installation begins. Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-set-python-environment-variable-pythonpath-on-mac
How to set python environment variable PYTHONPATH on Mac?
May 2, 2023 - Open the Terminal app on your Mac. Navigate to your home directory by typing cd ~ and pressing Enter. Open the .bash_profile file in a text editor by typing open -e .bash_profile and pressing Enter.
🌐
Twilio
twilio.com › en-us › blog › environment-variables-python
How to Set Environment Variables in Python | Twilio
September 3, 2025 - The format of a .env file is exactly the same under all operating systems, so .env files make working with environment variables uniform across all platforms. And as if this isn’t enough, having your environment variables written in a file that is automatically imported by Python means that you don’t have to manually set them every time you start a new shell.
🌐
Medium
medium.com › @B-Treftz › macos-adding-a-directory-to-your-path-fe7f19edd2f7
MacOS: Adding a directory to your PATH Variable | by Brian Treftz | Medium
June 22, 2024 - Note: If you’re following this method, replace the above path with the directory path you want to add to your PATH variable on your machine. (For those curious, this directory path allows me to launch a new instance of VSCode by simply typing “code” in Terminal and pressing enter. Additionally, if I include a file name after “code” (such as a zshrc file, Python file, or Jupyter notebook), it will open that file directly in VSCode — Nifty.
🌐
Python documentation
docs.python.org › 3 › using › mac.html
5. Using Python on macOS — Python 3.14.4 documentation
If you cannot depend on the link in /usr/local/bin pointing to the python.org free-threaded python3.14t (for example, if you want to install your own version there or some other distribution does), you can explicitly set your shell PATH environment variable to include the PythonT framework bin directory:
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to add python to path on windows, linux, and mac
How to Add Python to PATH on Windows, Linux, and Mac
December 12, 2025 - Add Python to the PATH variable to execute it without specifying the path. This tutorial shows you how to do it on Windows, Linux, and macOS.
🌐
Medium
medium.com › @haroldfinch01 › how-to-set-environment-variables-in-python-ee16132ca524
How to set environment variables in Python? | by Harold Finch | Medium
January 28, 2025 - Open Environment Variables from the System Properties. Add a new variable under System variables or User variables. Use .env Files: This keeps sensitive information out of your codebase and makes configuration easy to manage.
🌐
MathWorks
mathworks.com › matlab › external language interfaces › python with matlab › call python from matlab
Configure Your System to Use Python - MATLAB & Simulink
On Linux and macOS systems, if you build the Python executable, configure the build with the --enable-shared option. You can review the Python configure script options in the Configure Python documentation. When possible, use pyenv to set the Python interpreter.
🌐
Dagster
dagster.io › blog › python-environment-variables
Best Practices for Python Env Variables
You might type a command like python my_script.py to run a Python script, or ls (on Linux or Mac) or dir (on Windows) to list the files in the current directory. These are all examples of interacting with a command-line shell. Shell configuration files are special files that the shell reads when it starts up. As a Dagster data engineer, you will probably use them to set environment variables that should be available every time you open a new terminal window.
🌐
XDA Developers
xda-developers.com › home › macos › how to add python to path in macos
How to add Python to PATH in macOS
November 2, 2024 - Instead, you can add the directory of executable files to the PATH variable and simply enter the command name to access it. When you follow the steps below and add Python to the PATH on macOS, you can run Python scripts, manage packages, and simplify your Python development setup in no time.
🌐
Python documentation
docs.python.org › 3 › library › venv.html
venv — Creation of virtual environments
When a virtual environment has been activated, the VIRTUAL_ENV environment variable is set to the path of the environment.
🌐
Simplilearn
simplilearn.com › home › resources › software development › understanding the python path environment variable in python
Understanding the Python Path Environment Variable in Python [Updated]
September 14, 2025 - Python path is an environment variable used to maintain directories of custom Python libraries. Learn how to set a python path variable on Windows and Mac now!
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Codegive
codegive.com › blog › add_python_to_path_mac_os.php
Add python to path mac os
This tutorial will guide you through the process of adding Python to your PATH on macOS in a comprehensive, step-by-step manner. We'll cover what the PATH environment variable is, why it's important, how macOS handles Python by default, various methods for adding your preferred Python version ...
🌐
Vonage
developer.vonage.com › en › blog › python-environment-variables-a-primer
Python Environment Variables (Env Vars): A Primer
To set environment variables in Python, you can add them to the os.environ object like you would with a dictionary. However, only strings are permitted, as these are passed directly to the shell your interpreter is running in.