How to write and run Python using Xcode?

藏色散人
Release: 2020-09-17 11:08:53
Original
30748 people have browsed it

How to write and run Python using Xcode?

How to write and run Python using Xcode?

The steps to write and run Python using Xcode are:

1. Find the Python location:

Terminal input: which python

Get the installation location of python, usually /usr/bin/python. Obtaining this path is convenient for using it to build a python compilation environment.

2. Create a python program in Xcode

Open Xcode, create a new project (Shift Command N), select Cross-platform->Ohter-> ;External Build System, continue to the next step

Paste the python path you just found in the Build Tool, eg:/usr/bin/python, click Next:

3. Set Edit Scheme

After creating the project, click on the project chart in the upper left corner and select Edit Scheme

In the first option Executable in Info, select the path of python, eg:/usr/bin/python

In the second option Arguments, in the In an Arguments passed on launch, create a new .py file you are about to create, eg: main.py

In the third option Option, check Working Directory and Select the folder where the Xcode Project is located, which is the folder where your .py file is stored, and finally select OK.

4.Build and Run

Create a new file in the project (Command N), select macOS->Other->Empty, and name it just Add the file name in Scheme, eg: mian.py

Now write the code and click Run to compile and run the python program under Xcode.

The above is the detailed content of How to write and run Python using Xcode?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!