4

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).

ThR37
  • 3,965
  • 6
  • 35
  • 42
  • Have you checked your `.bash_profile`? – sobolevn Nov 03 '15 at 21:40
  • Hi and thanks for your input. Actually I am using zsh but there is nothing in shell config files (both in user/system zshrc and basic). I believe there must be something more general (like the /etc/paths.d or the /etc/paths) but I may be missing something obvious. – ThR37 Nov 03 '15 at 22:03
  • this may be helpfull: http://stackoverflow.com/questions/4271494/what-sets-up-sys-path-with-python-and-when – sobolevn Nov 04 '15 at 08:49

3 Answers3

17

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.

ZF007
  • 3,708
  • 8
  • 29
  • 48
ToKanhaku
  • 186
  • 2
  • 4
1

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

Adrian
  • 177
  • 1
  • 5
0

To remove python 3.5 from your mac try below command

cd /Library/Frameworks/Python.framework/Versions
sudo rm -rf 3.5