mac osx 上的 python 位置 [英] python location on mac osx

查看:36
本文介绍了mac osx 上的 python 位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 osx 上的 python 有点困惑.我不知道笔记本电脑的前任所有者是否使用 macport 安装了 macpython.我记得 osx 有一个内置版本的 python.我尝试使用 type -a python 并且结果返回

I'm a little confused with the python on osx. I do not know if the previous owner of the laptop has installed macpython using macport. And I remembered that osx has an builtin version of python. I tried using type -a python and the result returned

python is /usr/bin/python
python is /usr/local/bin/python

然而,在这些位置运行这两个 python 会给我 [GCC 4.2.1 (Apple Inc. build 5646)] on darwin.它们都指的是提供的相同的内置 python mac 吗?

However running both python at these locations give me [GCC 4.2.1 (Apple Inc. build 5646)] on darwin. Do they both refer to the same builtin python mac provided?

我还读到安装 macpython 会

I also read that installing macpython one would

     A MacPython 2.5 folder in your Applications folder. In here you
 find IDLE, the development environment that is a standard part of
 official Python distributions...

我查看了 Applications,有一个 MacPort 文件夹,其中包含 python2.6 和上面提到的内容.但是运行 IDLE,我发现了与上面相同的消息.

I looked at Applications, and theres a MacPort folder with python2.6 and the mentioned stuff in it. But running IDLE, i find the same message as above.

嗯,我有点困惑.哪个是哪个?

Hmm I'm a little confused. Which is which?

推荐答案

[GCC 4.2.1 (Apple Inc. build 5646)] 是构建 Python 的 GCC 版本与,而不是 Python 本身的版本.该信息应该在前一行.例如:

[GCC 4.2.1 (Apple Inc. build 5646)] is the version of GCC that the Python(s) were built with, not the version of Python itself. That information should be on the previous line. For example:

# Apple-supplied Python 2.6 in OS X 10.6
$ /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.
>>> 

# python.org Python 2.7.2 (also built with newer gcc)
$ /usr/local/bin/python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

/usr/bin 中的项目应该始终是或链接到 Apple 在 OS X 中提供的文件,除非有人不明智地更改了那里的内容.要查看 /usr/local/bin/python 链接到的确切位置:

Items in /usr/bin should always be or link to files supplied by Apple in OS X, unless someone has been ill-advisedly changing things there. To see exactly where the /usr/local/bin/python is linked to:

$ ls -l /usr/local/bin/python
lrwxr-xr-x  1 root  wheel  68 Jul  5 10:05 /usr/local/bin/python@ -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python

在这种情况下,这是典型的安装在 python.org 的 Python 实例,或者它可以是从源代码构建的实例.

In this case, that is typical for a python.org installed Python instance or it could be one built from source.

这篇关于mac osx 上的 python 位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆