I have recently installed the "official" Python 3.5 on Mac Os X (El Capitan). During this installation, Python changes the global path to include /Library/Frameworks/Python.framework/Versions/3.5/bin
(this can be seen using for instance /usr/libexec/path_helper
).
However, I am unable to understand where this "set" is done (there is nothing nor in /etc/paths
neither in /etc/paths.d
). I would like to remove this entry from the global path (without removing the installation itself because it can be always useful).
I have got the same issue. After a SUPER LONG search I found this file: "~/.zprofile"
. Check within this file and you will find the following code:
# Setting PATH for Python 3.5 # The original version is saved in .zprofile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" export PATH
Just remove this code and save the file.
I also had a similar output when running:
echo $PATH
Standard out-put result:
/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
The following sequence of steps solved the issue for me using zsh (macOS Big Sur Version 11.1)
cd /Users/JohnDoe
vim .zprofile
Remove the following PATH settings and save the file:
# Setting PATH for Python 3.8
#The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
# Setting PATH for Python 3.9
# The original version is saved in .zprofile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
export PATH
Refresh zsh profile from the users home directory:
source .zshrc
Check your work:
echo $PATH
Standard out-put result:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
To remove python 3.5 from your mac try below command
cd /Library/Frameworks/Python.framework/Versions
sudo rm -rf 3.5
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.