Python Crash Course study notes - Chapter 1: Getting Started

Python language is cross-platform, the latest version is 3.8.1, download see here .
The main purpose of this chapter is installed Python programming environment, and run a Hello World program.
Host I chose Oracle Linux 7, the use of vagrant installation, see here . So part of Windows and MacOS will skipped.
Editor authors recommend that Sublime Text , which implies the need for a graphical interface.

vi enhanced version of vim syntax highlighting:
Here Insert Picture Description
If vim is not installed, you can:

$ sudo yum -y install vim-enhanced
$ alias vi='vim' # 无需设置,在/etc/profile.d/vim.sh中会设置

So my advice is to use the Linux vim, Windows, then on Sublime Text and Visual Studio Code a second election.
But I still installed under Windows Sublime Text, after all, it also supports markdown, you can write documentation available.
Here Insert Picture Description
sublime text installation on Linux see here :

sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg
sudo yum-config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo
sudo yum install sublime-text

View Version:

$ python
Python 2.7.5 (default, Apr  9 2019, 16:02:27)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Installation python3, see here :

$ sudo yum install python3

In the new version to terminal mode (>>>) run python, you do not need a semicolon at the end of the statement:

$ python3
Python 3.6.8 (default, Aug  7 2019, 08:02:28)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39.0.1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello Python interpreter!")
Hello Python interpreter!
>>> 

Run python script:

$ mkdir ~/python_work # 这就是我们未来的工作目录
$ cd python_work/
$ cat hello_world.py
print("Hello Python world!")
$ python3 hello_world.py
Hello Python world!

Python's official website :
Here Insert Picture Description

Published 352 original articles · won praise 42 · views 550 000 +

Guess you like

Origin blog.csdn.net/stevensxiao/article/details/103964626