<p>如果使用PKG安装程序安装,则可以执行以下操作:</p>
<pre><code>pkgutil --pkgs
</code></pre>
<p>或者更好:</p>
<pre><code>pkgutil --pkgs | grep org.python.Python
</code></pre>
<p>它将输出如下内容:</p>
<pre><code>org.python.Python.PythonApplications-2.7
org.python.Python.PythonDocumentation-2.7
org.python.Python.PythonFramework-2.7
org.python.Python.PythonProfileChanges-2.7
org.python.Python.PythonUnixTools-2.7
</code></pre>
<p>现在可以选择要取消链接(删除)的包。</p>
<p>这是取消链接文档:</p>
<pre><code> --unlink package-id
Unlinks (removes) each file referenced by package-id. WARNING: This command makes no attempt to perform reference counting or dependency analy-
sis. It can easily remove files required by your system. It may include unexpected files due to package tainting. Use the --files command first
to double check.
</code></pre>
<p>在我的示例中,您将键入</p>
<pre><code>pkgutil --unlink org.python.Python.PythonApplications-2.7
pkgutil --unlink org.python.Python.PythonDocumentation-2.7
pkgutil --unlink org.python.Python.PythonFramework-2.7
pkgutil --unlink org.python.Python.PythonProfileChanges-2.7
pkgutil --unlink org.python.Python.PythonUnixTools-2.7
</code></pre>
<p>或一行:</p>
<pre><code>pkgutil --pkgs | grep org.python.Python | xargs -L1 pkgutil -f --unlink
</code></pre>
<p>重要提示:从Lion开始,unlink不再可用(从2014年第一季度起,将包括Lion、Mountain Lion和Mavericks)。如果任何人来这里的指示尝试使用它与狮子,应该尝试改为这篇文章所说的:<a href="https://wincent.com/wiki/Uninstalling_packages_(.pkg_files)_on_Mac_OS_X" rel="noreferrer">https://wincent.com/wiki/Uninstalling_packages_(.pkg_files)_on_Mac_OS_X</a></p>