问题描述
我使用Windows.我编写了一个Python 3.1脚本,使用Mac的朋友想运行它,但是我们无法让Python 3.1在他的Mac上正常工作.我认为问题在于未安装Python 3.1框架.这正是我所做的事情,也是为什么我认为这是问题所在.
I use Windows. I wrote a Python 3.1 script that my Mac-using friend would like to run, but we can't get Python 3.1 to work right on his Mac. I think the problem is that the Python 3.1 framework is not being installed. Here's exactly what what I did and why I think this is the problem.
我从Python下载页面(此文件).我打开了文件,然后打开了"Python.mpkg".我继续进行安装向导,并确保在向导过程中选中用于安装"Shell配置文件更新程序"的框.我转到"/Applications/Python 3.1"并双击"Update Shell Profile.command".
I downloaded Python 3.1.2 from the Python download page (this file). I opened the file, then opened "Python.mpkg". I proceeded with the install wizard, and I made sure to check the box to install "Shell profile updater" during the wizard. I went to "/Applications/Python 3.1" and double-clicked "Update Shell Profile.command".
接下来,我选择编写的python脚本,然后在菜单栏中选择文件",获取信息".在打开方式"下,我从"/Applications/Python 3.1"中选择了"PythonLauncher".然后,我单击全部更改"按钮.现在,我双击我的程序来运行它,但是它是由Python 2.5.1而不是Python 3.1运行的. (对此,我很确定,我编写了一个程序"print(sys.version)".)
Next I selected the python script I wrote and selected "File", "Get Info" in the menu bar.Under "Open With" I selected "PythonLauncher" from "/Applications/Python 3.1". I then clicked the "Change All" button. Now I double-clicked my program to run it, but it was run by Python 2.5.1 instead of Python 3.1. (I'm sure of this, I wrote a program to "print(sys.version)".)
所以现在我试图弄清楚为什么"/Applications/Python 3.1"中的"PythonLauncher"使用的是Python 2.5.1.我打开"PythonLauncher",发现"Python脚本"的解释器为"/usr/bin/pythonw".因此,我转到"/usr/bin/",发现"pythonw"是指向"/System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5"的别名.显然,这应该是3.1版.因此,我转到"/System/Library/Frameworks/Python.framework/Versions/",发现仅有的子文件夹为"2.3"和"2.5". 3.1在哪里?
So now I tried to figure out why the "PythonLauncher" from "/Applications/Python 3.1" is using Python 2.5.1. I opened "PythonLauncher" and found that the interpreter for "Python Script" is "/usr/bin/pythonw". So I went to "/usr/bin/" and discovered that "pythonw" was an alias pointing to "/System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5". Obviously this should be version 3.1 instead. So I went to "/System/Library/Frameworks/Python.framework/Versions/" and discovered that the only sub-folders are "2.3" and "2.5". Where's 3.1?
推荐答案
看看 PythonBrew .它使在Mac上安装Python变得容易得多.
Take a look at PythonBrew. It made installing Python on my Mac a lot easier.
这也可能有帮助:
这篇关于在Mac OS X 10.5.8版上安装Python 3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!