<p>假设安装了Python,这应该可以工作:</p>
<blockquote>
<p><a href="https://docs.python.org/2/using/mac.html" rel="nofollow">https://docs.python.org/2/using/mac.html</a></p>
<p>Select PythonLauncher as the default application to open your script
(or any .py script) through the finder Info window and double-click
it. PythonLauncher has various preferences to control how your script
is launched. Option-dragging allows you to change these for one
invocation, or use its Preferences menu to change things globally.</p>
</blockquote>
<p>附录:</p>
<blockquote>
<p><a href="http://docs.python-guide.org/en/latest/starting/install/osx/" rel="nofollow">http://docs.python-guide.org/en/latest/starting/install/osx/</a></p>
<p>The latest version of Mac OS X, El Capitan, comes with Python 2.7 out
of the box.</p>
<p>You do not need to install or configure anything else to use Python.
Having said that, I would strongly recommend that you install the
tools and libraries described in the next section before you start
building Python applications for real-world use. In particular, you
should always install Setuptools, as it makes it much easier for you
to use other third-party Python libraries.</p>
<p>The version of Python that ships with OS X is great for learning but
it’s not good for development.</p>
</blockquote>
<p>附录2:</p>
<p>苹果在ElCapitan做了一些改变(包括<a href="http://arstechnica.com/apple/2015/09/os-x-10-11-el-capitan-the-ars-technica-review/8/" rel="nofollow">System Integrity Protection</a>),这可能会导致安装失败,因为臭名昭著的“找不到可安装的软件”。例如:</p>
<ul>
<li><a href="http://trac.wxwidgets.org/ticket/17203" rel="nofollow">http://trac.wxwidgets.org/ticket/17203</a></li>
</ul>
<p>解决方法:</p>
<p>使用自制。这正是我上面引用的<a href="http://docs.python-guide.org/en/latest/starting/install/osx/" rel="nofollow">Installing Python on Mac OS X</a>所建议的:</p>
<pre><code>$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ vi ~/.profile =>
...
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
$ brew install python
</code></pre>
<p>如果这对你不起作用,请告诉我。</p>