Python in Xcode4

来源:互联网 发布:网络监控工程宝怎么用 编辑:程序博客网 时间:2024/06/13 09:34
1.Create "External Build System" project.
2.Set "Build Tool" as "/usr/bin/python".
3.Add "Empty" type "file.py" to project.
4."Edit scheme"->"Run"->"Info"->"Executable" as "/usr/bin/python"(use ⇧⌘G).
5.For the "Debugger" field, select "None".
6."Edit scheme"->"Run"->"Arguments"->"Arguments Passed On Launch" as "path/file.py".

//===============================================================================
[转]http://blog.roto.tw/archives/206
Open Xcode 4.
In the menu bar, click "File" -> "New" -> "New Project…".
Select "Other" under "Mac OS X".
Select "External Build System" and click "Next".
Enter the product name.
For the "Build Tool" field, type in "/usr/local/bin/python3″ for Python 3 or "/usr/bin/python" for Python 2 without the quotes and then click "Next".
Choose where to save it and click "Create".
In the menu bar, click "File" -> "New" -> "New File…".
Select "Other" under "Mac OS X".
Select "Empty" and click "Next".
Navigate to the project folder (it will not work, otherwise), enter the name of the Python file (include the ".py" extension), and click "Save".
In the menu bar, click "Product" -> "Edit Scheme…".
Click "Run" in the left column.
In the "Info" tab, click the "Executable" field and then click "Other…".
Navigate to the executable from Step 6. You may need to use ⇧⌘G to type in the directory if it is hidden.
Select the executable and click "Choose".
For the "Debugger" field, select "None".
In the "Arguments" tab, click the "Base Expansions On" field and select the target you created earlier.
Click the "+" icon under "Arguments Passed On Launch". You may have to expand that section by clicking on the triangle pointing to the right.
Type in "$(SOURCE_ROOT)/" without the quotes and then the name of the Python file you want to test. Remember, the Python program must be in the project folder. Otherwise, you will have to type out the full path here.
Click "OK".
Start coding.

原创粉丝点击