首页 > 编程学习 > Python基础-1-环境搭建(初体验)

Python基础-1-环境搭建(初体验)

发布时间:2022/11/21 0:52:09

一:开发环境

Linux-5.15.0(Ubuntu22.04)

二:安装Python3

1、安装:sudo apt-get install python3

2、版本查询:

python3 --version

 python3进入python解释器也可查询对应版本,按Ctrl+D或执行命令exit()退出。

 本专栏所有代码运行于Python3.6或更高版本,后文中出现python均代表python3。

三:运行HelloWorld程序

1、解释器中运行

 2、py脚本运行

(1)将python环境写入py脚本

#!/usr/bin/python3

print("Hello World,Python!")

 (2)使用Python执行py脚本

print("Hello World,Python!")

Python之禅

Python的学习之旅就此拉开序幕,“禅”之理念伴我左右,变秃变强!

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

Copyright © 2010-2022 dgrt.cn 版权所有 |关于我们| 联系方式