[Development environment] Python with Xcode [With screen transition]

To run Python in Xcode ...

This time, I will introduce the procedure of Python development environment in Xcode with images.

Previously, I posted the procedure for executing C language in Xcode: C language on Mac, but the search results are quite good for this procedure as well. I didn't have it, so I summarized the procedure with ** screen transition **.

Recommended for people like this

・ ** People who really want to learn Python with Xcode. ・ People who want to try programming on Mac but prefer a simple language. ・ People who want to try Python because I heard rumors that it is strong in artificial intelligence.

Things necessary

・ Mac and Xcode

Prepare the development environment

1-1. Launch Xcode and select Create a New Xcode Project. スクリーンショット 2016-05-28 11.16.37.png

1-2. A screen will open, select Other> External Build System. It's an item that you would never select if you were developing an application with Swift (laughs). スクリーンショット 2016-05-28 11.17.08.png

1-3. Decide on a Product Name and enter / usr / bin / python in the Build Tool. In addition, enter something in the Organization identifier. ** Don't think about why you need to enter it ** It's better to go ahead. Think you need it to do it. スクリーンショット 2016-05-28 11.21.02.png

Save the created Project File to any location. (This time I saved it on my desktop)

2-1. Select File> New> File ... at the top left of the screen to create a Python file. スクリーンショット 2016-05-28 11.31.06.png

2-2. Choose Other> Empty. スクリーンショット 2016-05-28 11.31.13.png

2-3. Decide on a File name and make sure that Targets contains Check. Don't forget the extension (.py). スクリーンショット 2016-05-28 11.31.34.png

Make sure that the file you created is added in the upper left. スクリーンショット 2016-05-28 11.32.15 のコピー.png

3-1.

From here it gets a little confusing. Select Product> Scheme> Edit Scheme. スクリーンショット 2016-05-28 11.26.17.png

3-2. Select Run> info> Executable> Other. スクリーンショット 2016-05-28 11.27.36.png

3-3. ** Enter Command + Shift + G on your keyboard. ** Then, Go to the folder: will be displayed. Enter / usr / bin / python and press Go. スクリーンショット 2016-05-28 11.27.55.png

3-4. Make sure Python is selected in light gray, then select Choose. スクリーンショット 2016-05-28 12.46.40.png

3-5. After confirming that python is displayed in Executable, uncheck Debug executable. Do not press Close at the bottom right of the screen yet. スクリーンショット 2016-05-28 11.28.15.png

3-6. Arguments> +> Enter the name of the created file. スクリーンショット 2016-05-28 12.53.59.png

3-7. Click the Options> Working Directory> Folder icon. スクリーンショット 2016-05-28 13.02.42.png

Select the created Project File. スクリーンショット 2016-05-28 11.30.26.png

3-8. When you select Project File, confirm that it is displayed like an image (your user name is displayed for the part labeled as user name), and press Close. スクリーンショット 2016-05-28 11.29.58.png

4. In the created file,

print "Hello, World!!"

When I enter and execute it ... スクリーンショット 2016-05-28 14.43.55.png

** Displayed safely! !! ** **

** * Supplement ** If you see the screen below instead of Hello, World !! when you run it, review the Product settings. スクリーンショット 2016-05-28 14.43.06.png

that's all. This time it was Python, but if you do the same in other languages, it seems that you can run it in Xcode (I haven't tried it, I'm sorry).

Postscript 2019.3.9

The UI of Xcode may have changed a little, but I confirmed that it can be created by following the same procedure. At that time, it's a mystery why I tried to run Python in Xcode so far. Maybe I didn't know the existence of Jupyter. I think it's definitely easier to install Anaconda.

Recommended Posts

[Development environment] Python with Xcode [With screen transition]
Prepare Python development environment with Atom
Python development environment construction
About Python development environment
Python environment with docker-compose
python2.7 development environment construction
Development environment in Python
Virtual environment with Python 3.6
Build Python development environment with Visual Studio Code
[Python] Build a Django development environment with Docker
Get a quick Python development environment with Poetry
Virtualize (isolate) IBM i python development environment with chroot
Install Python environment with Anaconda
Manage python environment with virtualenv
Create a python development environment with vagrant + ansible + fabric
Build python3 environment with ubuntu 16.04
Screen switching / screen transition with Tkinter
Prepare python3 environment with Docker
Build python environment with direnv
Organize your Python development environment
[ev3dev × Python] Build ev3dev development environment
Build a machine learning application development environment with Python
Python development environment with Windows + Anaconda3 + Visual Studio Code
QGIS3 Python plugin development environment construction with VSCode (macOS)
Manage Python runtime packages and development environment packages with Poetry
Python development environment with Windows + Python + PipEnv + Visual Studio Code
[MEMO] [Development environment construction] Python
[For organizing] Python development environment
Set up a Python development environment with Sublime Text 2
Unify the environment of the Python development team starting with Poetry
Set up a Python development environment with Visual Studio Code
Video cannot be loaded with Spyder in Python development environment
Prepare Python development environment with Mac + Windows + VisualStudio Code (Windows version)
Prepare Python development environment with Mac + Windows + VisualStudio Code (Mac version)
Get a clean Python development environment with pyenv + pipx + Poetry
How to build a python2.7 series development environment with Vagrant
Create a simple Python development environment with VSCode & Docker Desktop
How to get into the python development environment with Vagrant
Get started with Python! ~ ① Environment construction ~
Prepare Python development environment on Ubuntu
Build python virtual environment with virtualenv
Setup modern Python environment with Homebrew
Build Mysql + Python environment with docker
Create a virtual environment with Python!
Get web screen capture with python
Prepare your first Python development environment
[Python3] Development environment construction << Windows edition >>
Building a virtual environment with Python 3
Python development environment options for May 2020
Python development environment construction on macOS
Othello game development made with Python
Vim + Python development environment setting memo
Emacs settings for Python development environment
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Install Python development environment on Windows 10
Emacs Python development environment construction memo
Checking the NAOqi Python development environment
pytorch @ python3.8 environment construction with pipenv
Rebuild Django's development environment with Docker! !! !! !!
Application development with Docker + Python + Flask
Prepare the development environment with anyenv