Environment depends on
MacOS, Xcode 9, Python(Python2.7 is installed on macOS by default).
The first step The f I rs T s T ep
External Build System Ext E rnal Bu I ld Sy S t E m
/usr/bin/python/u sr/ B I n/ Py T hon Build Tool Bu I ld Tool As shown in figure:
If the local Python Python path is not this, you can find it by typing which Python wh I ch Python on the command line.
Anything else is the same as creating a project. Fill in the necessary information and modify the path.
The second step The second s T ep: edit Scheme s cheme
Next we need to Edit Scheme S C H E M E, as shown in the picture, click Edit Scheme… E d I t S c h E m E..
Run−Arguments Run−A R guments Executable Ex E cutab L E select Other Oth E R, as shown in the following figure:
Enter “/” “/” (without quotation marks) on the keyboard to pop up the input path window. Enter the previous path, mine is /usr/bin/u sr/b I n/, as shown in the following figure:
Select python python, default Debugexecutable Deb U G E x E C U T a B L E
Run−Arguments Run−A R guments Click “+” “+” On Launch Argument S P A S sed On L A unch.
Then enter Run−Options Run−Opt I O ns and add WorkingDirectory W O R k I ngD I R ect O R y. It’s possible to use relative directories, but I’m using absolute directories.
Now that we’re done, we can Close C, L, O, S, e.
The third part The Th I rd par T: Create Py file and test
Create a new Empty Empty file and call it test.py t E st.
Print (“Hello World”) pr I nt(“Hello World”)
Not well, Python p Y T H o N tells us we can’t find the file…
Test.py Test.py Now Group Now Group test.py Tes T Now Group Now Group test.py Tes T Test.py Test.py file cannot be found.
Run−Arguments Run−A R guments Click Arguments Passed On Launch Arguments P A S s d On L A unch “+” “+”
Command+R Command+R Hello World Hel L o Wo R L d