How does one create a Python friendly environment in Xcode 4, 5, 6 or 7?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
Try Editra It's free, has a lot of cool features and plug-ins, it runs on most platforms, and it is written in Python. I use it for all my non-XCode development at home and on Windows/Linux at work.
This Technical Note TN2328 from Apple Developer Library helped me a lot about Changes To Embedding Python Using Xcode 5.0.
You should try PyDev plug in for Eclipse. I tried alot of editors/IDE's to use with python, but the only one i liked the most is the PyDev plugin for Eclipse. It has code completion, debugger and many other nice features. Plus both are free.
This thread is old, but to chime in for Xcode Version 8.3.3, Tyler Crompton's method in the accepted answer still works (some of the names are very slightly different, but not enough to matter).
2 points where I struggled slightly:
Step 16: If the python executable you want is greyed out, right click it and select quick look. Then close the quick look window, and it should now be selectable.
Step 19: If this isn’t working for you, you can enter the name of just the python file in the Arguments tab, and then enter the project root directory explicitly in the Options tab under Working Directory--check the “Use custom working directory” box, and type in your project root directory in the field below it.
I've created Xcode 4 templates to simplify the steps provided by Tyler.
The result is Python Project Template for Xcode 4.
Now what you need to do is download the templates, move it to
/Developer/Library/Xcode/Templates/Project Templates/Mac/Others/
and then new a Python project with Xcode 4.It still needs manual Scheme setup (you can refer to steps 12–20 provided by Tyler.)
Procedure to get Python Working in XCode 7
Step 1: Setup your Project with a External Build System
Step 1.1: Edit the Project Scheme
Step 2: Specify Python as the executable for the project (shift-command-g) the path should be /usr/bin/python
Step 3: Specify your custom working directory
Step 4: Specify your command line arguments to be the name of your python file. (in this example "test.py")
Step 5: Thankfully thats it!
(debugging can't be added until OSX supports a python debugger?)