SoFunction
Updated on 2025-04-10

Two solutions for configuring python environment variables in mac system

The latest mac computer, the configuration principle has not been studied yet, please answer questions

Plan 1

Get the installation path of python

which python3

Configure environment variables

open ~/.bash_profile

Add at the end:

PATH="/Library/Frameworks//Versions/3.13/bin:${PATH}"
export PATH
alias python="/Library/Frameworks//Versions/3.13/bin/python3"

First lineandThe third lineFor installation path

Take effect immediately

source ~/.bash_profile

Check whether it is effective

I don't know how to verify it yet, and I'm going to be researched (but my problem was successfully solved)

Solution 2 (seemingly useless)

Configure environment variables

nano ~/.zshrc

Add at the end:

PATH="/Library/Frameworks//Versions/3.13/bin:${PATH}"
export PATH
alias python="/Library/Frameworks//Versions/3.13/bin/python3"

First lineandThe third lineFor installation path

Take effect immediately

source ~/.zshrc

Check whether it is effective

echo $python  (useless)

alias python

Summarize

This is the end of this article about the two solutions for configuring python environment variables in mac system. For more related contents of configuring python environment variables in mac, please search for my previous articles or continue browsing the following related articles. I hope everyone will support me in the future!