views:

141

answers:

3

The Python 2.7 installer disk image for Mac OS X (python-2.7-macosx10.5.dmg) states:

The installer puts the applications in "Python 2.7" in your Applications folder, command-line tools in /usr/local/bin and the underlying machinery in /Library/Frameworks/Python.framework.

However, after installation there are no Python 2.7 files in /usr/local/bin/.

  • Are others seeing the same behavior?
  • I assume the solution is simply to create the equivalent symbolic links to /usr/local/bin as Python 2.6, or am I overlooking something?
A: 
11:54 jsmith@upsidedown find /usr -name python2.7
11:54 jsmith@upsidedown

Yeah, that sucks.

I'd follow the pattern that the Python 2.6 (and, in my case, 2.5) installer did, and create the symlinks (as you're suspecting). The pattern stayed the same, at least:

11:57 jsmith@upsidedown /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Python 2.7 (r27:82508, Jul  3 2010, 21:12:11) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Might be worth a bug report against the installer.

Jed Smith
+2  A: 

The python.org Python installer for OS X is a meta package with a set of several packages. You can see the packages by clicking on the Customize button during the installation process. The symlinks in /usr/local/bin are installed by the UNIX command-line tools package. For the 2.7 release, that package is no longer selected by default. You can install it and the symlinks by doing a custom install and selecting that package; if you've already installed 2.7, select just that package.

EDIT: That said, it is important to recognize that, with OS X Python framework builds, just having /usr/local/bin in your search path is generally not sufficient. The reason for that is that python scripts included in packages are, by default, installed into the bin directory of the Python directory, e.g. /Library/Frameworks/Python.framework/Versions/2.7/bin. This is true of just about anything that uses Distutils defaults or installation tools that wrap Distutils, like easy_install (Distribute or setuptools) or pip. This is why there is another installer package, Shell profile updater, that is enabled by default and attempts to modify your login profile to put the framework bin directory at the front of your shell search path, PATH. If that is done, the symlinks in /usr/local/bin are not required for python2.7 to be invoked.

Ned Deily
I've opened an issue on this: http://bugs.python.org/issue9275
Ned Deily
Ned — Without the symlinks, I was getting an error when trying to create a virtualenv using Python 2.7 while Python 2.6.5 is setup as my default install (i.e., I have PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"in my `~/.bash_profile` for 2.6 by not for 2.7). Now that the symlinks are installed, I am able to `mkvirtualenv -p python2.7 foo27` to create a virtualenv using Python 2.7.
Matthew Rankin
If you add the 2.7/bin to your path to your PATH that should solve the problem as well. If you want the default `python` to remain the python.org 2.6, then you would need to insert 2.7/bin after 2.6 bin: `PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
Ned Deily
A: 

Steven Majewski's comment stating "I believe I had to explicitly select that option ( "install command line tools" ) in the installer" made me think that I overlooked something in the installer. Sure enough, I overlooked the Customize option. See below.

Optional Customize Python Install

Select UNIX Command-Line Tools

Matthew Rankin
As I note in my response and comments, while there's nothing wrong with installing the /usr/local/bin links with the `UNIX command-line tools` package (and I agree that they should still be installed by default), doing so is not sufficient to have a correctly working 2.7 installation once you try to install 3rd-party packages. By default, even `easy_install` itself ends up in the `2.7/bin` directory, not `/usr/local/bin`.
Ned Deily