This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Mac installer need not add things to /usr/local
Type: enhancement Stage:
Components: macOS Versions: Python 3.3, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: eric.araujo, ned.deily, reowen, ronaldoussoren
Priority: normal Keywords:

Created on 2011-01-20 23:30 by reowen, last changed 2022-04-11 14:57 by admin.

Messages (3)
msg126661 - (view) Author: Russell Owen (reowen) Date: 2011-01-20 23:30
The Mac installer alters the user's $PATH to put /Library/Frameworks/Python.Framework/Versions/Current/bin on the $PATH before /usr/local/bin and /usr/bin. This is a good idea in my opinion.

But the installer *also* installs numerous symlinks in /usr/local/bin. These symlinks are redundant with altering the $PATH. Thus they are redundant. They are also make it difficult to switch versions of python because it's tricky to know which symlinks should be deleted (and the list may depend on the current version of python).

This is problem for me because I often have to switch versions of Python while building binary installers for packages such as matplotlib.

My request is for the Mac python installer to leave /usr/local/bin alone.

For if there is a need to add symlinks to /usr/local/bin that I'm not seeing then my request is for an easy way to switch versions of python or at least get rid of the symlinks, e.g. a python version switcher script or symlink deletion script.
msg126702 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-01-21 07:53
Adding the symlinks to /usr/local is an option in the OS X installer.  Although it is enabled by default, you can easily disable it in Installer.app by selecting "Customize" and then unchecking the install of the "UNIX command-line tools" package.

The main reason for installing the symlinks by default is, I believe, a historical one.  Using /usr/local/bin/ to refer to an alternate Python is an established custom.  On the other hand, as you point out, adding the OS X framework bin directory to the path is accomplishes the same thing and is more robust and, in fact, necessary if packages are installed that add console scripts (unless a symlink is manually created in /usr/local/bin for the console script).

With the likely ongoing requirement for multiple Python versions for many users, it would be good to have a better way to manage versions than the current rather simplistic approach, i.e. the installer supplied 'Update Shell Profile.command'.
msg224036 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2014-07-26 09:47
There'd still need to be some way to update the shell environment, but I agree that there needs to be something better than we have now.

One option is to add a small shell script that can be sourced from the shell profile and adds the various python frameworks at the right place in sys.path (dynamically checks what's there instead of hardcoding a version in the command file we now use).

A nice option to add is to optionally use a configuration file in ~/Library/Python to control the order in which directories are added to have some control on which version of python is used when starting it without a full version.  There would then also need to be a script that manages that configuration file.
History
Date User Action Args
2022-04-11 14:57:11adminsetgithub: 55173
2014-07-26 09:47:46ronaldoussorensetmessages: + msg224036
2011-05-07 15:30:39eric.araujosetnosy: + eric.araujo
2011-01-21 07:53:14ned.deilysetnosy: + ned.deily

messages: + msg126702
versions: + Python 3.3
2011-01-20 23:30:27reowencreate