[英]Why aren't the Python 2.7 command-line tools located in `/usr/local/bin` on Mac OS X?
The Python 2.7 installer disk image for Mac OS X ( python-2.7-macosx10.5.dmg
) states: Mac OS X的Python 2.7安装程序磁盘映像( python-2.7-macosx10.5.dmg
)状态:
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. 安装程序将应用程序放置在“应用程序”文件夹中的“ Python 2.7”中,将命令行工具放置在/ usr / local / bin中,并将基础机械放置在/Library/Frameworks/Python.framework中。
However, after installation there are no Python 2.7 files in /usr/local/bin/
. 但是,安装后, /usr/local/bin/
中没有Python 2.7文件。
/usr/local/bin
as Python 2.6, or am I overlooking something? 我认为解决方案只是创建与Python 2.6等效的/usr/local/bin
符号链接,还是我忽略了什么? The python.org Python installer for OS X is a meta package with a set of several packages. OS X的python.org Python安装程序是一个元软件包,其中包含几个软件包。 You can see the packages by clicking on the Customize
button during the installation process. 您可以在安装过程中单击“ Customize
按钮来查看软件包。 The symlinks in /usr/local/bin
are installed by the UNIX command-line tools
package. /usr/local/bin
中的符号链接由UNIX command-line tools
软件包安装。 For the 2.7 release, that package is no longer selected by default. 对于2.7版本,默认情况下不再选择该程序包。 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. 如果您已经安装了2.7,请仅选择该软件包。
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. 编辑:也就是说,重要的是要认识到,使用OS X Python框架构建时,仅在搜索路径中具有/usr/local/bin
通常是不够的。 The reason for that is that python scripts included in packages are, by default, installed into the bin directory of the Python directory, eg /Library/Frameworks/Python.framework/Versions/2.7/bin
. 原因是默认情况下,软件包中包含的python脚本安装在Python目录的bin目录中,例如/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
. 这几乎适用于所有使用Distutils
默认值或包装Distutils
安装工具的东西,例如easy_install
( Distribute
或setuptools
)或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
. 这就是为什么还有另一个安装程序软件包Shell profile updater
,该软件包软件包默认情况下处于启用状态,并尝试修改您的登录配置文件以将framework框架目录放在shell搜索路径PATH
的前面。 If that is done, the symlinks in /usr/local/bin
are not required for python2.7
to be invoked. 完成后,调用python2.7
不需要/usr/local/bin
中的符号链接。
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. Steven Majewski的评论说:“我相信我必须在安装程序中明确选择该选项(“安装命令行工具”)”,使我认为我忽略了安装程序中的某些内容。 Sure enough, I overlooked the Customize
option. 果然,我忽略了“ Customize
选项。 See below. 见下文。
Optional Customize Python Install http://img.skitch.com/20100716-ede8ausmtch9cb6g4mqp4hcm84.jpg 可选的自定义Python安装http://img.skitch.com/20100716-ede8ausmtch9cb6g4mqp4hcm84.jpg
Select UNIX Command-Line Tools http://img.skitch.com/20100716-817rjbyikr8c4y88xkfj6qeg1p.jpg 选择UNIX命令行工具http://img.skitch.com/20100716-817rjbyikr8c4y88xkfj6qeg1p.jpg
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). 我将遵循Python 2.6(在我的情况下为2.5)安装程序的模式,并创建符号链接(如您所怀疑)。 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. 可能值得针对安装程序进行错误报告。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.