Snow Leopard 上的 MacPorts:Python 安装似乎成功,但未安装非系统 Python

发布于 2024-10-10 18:55:47 字数 869 浏览 0 评论 0原文

我已经通过 MacPorts 安装了 Python。根据 这个问题,/opt/local/bin 中的文件应该运行“正确的”Python 版本。然而,所有这些文件都是符号链接到:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ 

直接从该文件夹运行它们(不使用符号链接)会运行 Apple 版本的 Python!

Python 2.6.6 (r266:84292, Jan  6 2011, 13:25:25) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

为了进行比较,运行 /usr/bin/python 显示的版本略有不同:

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

它们都是 Apple 版本!如何安装正确的版本?

I've installed Python via MacPorts. According to this question, the files in /opt/local/bin should run the "correct" Python version. However, all those files are symlinks to:

/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/ 

Running them directly from that folder (using no symlinks) runs an Apple build of Python!

Python 2.6.6 (r266:84292, Jan  6 2011, 13:25:25) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

For comparison, running /usr/bin/python shows a slightly different version:

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

They're both Apple builds! How do I install the correct version?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

原来是傀儡 2024-10-17 18:55:47

除了系统 Python(据我所知,Snow Leopard 上是 2.6.1)之外,没有“Apple 版本”。在这种情况下,ports 安装似乎按预期工作。对 Apple 的引用是对所使用的 GCC 的引用。

There are no "Apple builds" except the system Python (which is 2.6.1 on Snow Leopard, afai can deduce). The ports install seems to have worked as expected in this case. The reference to Apple is a reference to which GCC that was used.

他是夢罘是命 2024-10-17 18:55:47

我认为它正在运行您想要的构建。

macports 将所有内容安装在 /opt/local 中。所以/opt/local/bin/python 是一个macport 发行版

/usr/bin/python 是 mac os x 附带的预安装 python 发行版。

以下行是有关 gcc 构建的信息,用于构建 macport python 发行版。

[GCC 4.2.1(Apple Inc. 版本 5664)]

如果您安装了多个版本的 macport python,您可以使用 python-select 选择版本

sudo port install python-select sudo
python-select python26

另外,为了确保您使用 macport python,您可以将以下内容添加到 PATH

export PATH=/opt/local/bin:$PATH

I think it is running the build you want.

macports install every thing in /opt/local. So /opt/local/bin/python is a macport distribution.

/usr/bin/python is pre-install python distribution that comes with mac os x.

The following line, is an information about gcc build which is used for building macport python distribution.

[GCC 4.2.1 (Apple Inc. build 5664)]

If you have multiple versions of macport python installed, you can select the version using python-select

sudo port install python-select sudo
python-select python26

Also to ensure that you use macport python you could add the following to the PATH

export PATH=/opt/local/bin:$PATH
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文