提示

本文主要讲解 Pyton 的起源,主要讲解的版本是 Python3 @ermo

# Python 概述

# 什么是 Python

Python 是由 “龟叔” Guido van Rossum 在八十年代末和九十年代初发明的。Python 是一门解释性,可交互,面相对象的编程语言。

解释性和 Java 这种编译性的编程语言形成对比,用 Python 编写的代码无需编译就可以执行。

# 安装 Python

本示例演示使用 MacOS 安装 Python3。

Python3 的官网地址为 https://www.python.org/downloads/ (opens new window)

下载后的 pkg 包直接双击安装。

安装完成打开终端输入

python3

输出内容

Python 3.12.6 (v3.12.6:a4a2d2b0d85, Sep  6 2024, 16:08:03) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

# 第一行代码

安装后 python3 运行环境后,打开命令行终端,执行:

python3

输入内容

Python 3.12.6 (v3.12.6:a4a2d2b0d85, Sep  6 2024, 16:08:03) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

然后输入

>>> print("hello world python")

输出内容为

hello world python

至此,已经完成 python 的第一行代码。