简体   繁体   English

如何在Mac上安装/运行Python

[英]How to install/run Python on a Mac

After giving up on doing a disk partition and getting Linux, I decided to try and install Python 3.3.2 on a 32 bit Intel Core 2 Duo iMac with OS X 10.6.8 Snow Leopard. 在放弃做磁盘分区并获得Linux之后,我决定尝试在OS X 10.6.8 Snow Leopard的32位Intel Core 2 Duo iMac上安装Python 3.3.2。 I did pretty much everything the official website says, but it isn't working at all. 我几乎完成了官方网站所说的一切,但根本无法正常工作。

First of all, I downloaded the installer for Mac OS X 6 and later, which should supposedly put a folder called MacPython 3.3 with IDLE, PythonLauncher and a Build Applet tool in my Applications folder. 首先,我下载了Mac OS X 6和更高版本的安装程序,应该在我的Applications文件夹中放置一个名为MacPython 3.3的文件夹,其中包含IDLE,PythonLauncher和Build Applet工具。 What I have instead is a folder called Python 3.3 which does contain (aside from the documentation and a command to update shell profile) IDLE and PythonLauncher, but no Build Applet tool; 我所拥有的是一个名为Python 3.3的文件夹,它确实包含(除了文档和用于更新外壳配置文件的命令)IDLE和PythonLauncher,但没有Build Applet工具; I typed 'python' into my Terminal window to see if 3.3.2 was installed, but it said Python 2.6.1 even after restarting my computer. 我在“终端”窗口中键入了“ python”以查看是否已安装3.3.2,但即使重新启动计算机后,它仍显示Python 2.6.1。 The ReadMe in the disk image that contains the installer says running the installer should also 'put the underlying machinery into the folder /Library/Frameworks/Python.framework'. 包含安装程序的磁盘映像中的自述文件指出,运行安装程序还应“将基础机器放入文件夹/Library/Frameworks/Python.framework中”。 I did every search imaginable and apparently there is no such folder anywhere in my hard drive. 我进行了所有可以想象的搜索,并且显然硬盘中没有文件夹。

Basically, I want to install 3.3.2 and run things in programme mode rather than shell mode, which I find to be a huge pain in the bottom. 基本上,我想安装3.3.2并以程序模式而不是shell模式运行程序,这在底层让我感到非常痛苦。 Any help is greatly appreciated. 任何帮助是极大的赞赏。

You don't need to download or install any software. 您无需下载或安装任何软件。

Just write your code in your preferred text editor, and save it as a anything with .py at the end. 只需在您喜欢的文本编辑器中编写代码,然后将其另存为.py Next, go to a terminal and type in python *****.py , where ***** means whatever your file is named. 接下来,进入终端并输入python *****.py ,其中*****表示文件的名称。

尝试在终端中输入“ idle python3.3”或类似内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM