Python Basic python Introduction

Source: Internet
Author: User

About Python

Because Python is cross-platform, it can run on Windows, Macs, and various Linux/unix systems. Write a Python program on Windows and put it on Linux to run it.

To start learning Python programming, you first have to install Python on your computer. Once installed, you will get the Python interpreter (which is responsible for running the Python program), a command-line interaction environment, and a simple integrated development environment.

Installing Python 3.6

Currently, Python has two versions, one is version 2.x, the other is 3.x, and these two versions are incompatible. Due to the increasing popularity of the 3.x version, our tutorials will be based on the latest Python version 3.6. Make sure that the Python version installed on your PC is up-to-date 3.6.x so that you can learn this tutorial without pain.

Install Python on your Mac

If you are using a Mac and the system is OS X 10.8~10.10, then the Python version that comes with the system is 2.7. To install the latest Python 3.6, there are two methods:

Method One: Download the Python 3.6 installation program from the Python website (please visit the local mirror for the slow speed), double-click to run and install;

Method Two: If homebrew is installed, it can be installed directly by the command brew install python3 .

Install Python on Linux

If you are using Linux, then I can assume that you have Linux system management experience, self-installing Python 3 should be no problem, otherwise, please change back to the Windows system.

For a large number of students who are still using Windows, you can continue reading the following if you don't want to change your Mac in the short term.

Install Python on Windows

First, depending on your version of Windows (64-bit or 32-bit), download Python 3.6 for the 64-bit installer or 32-bit installer from the official Python website (please visit the local mirror for slow students), then run the downloaded EXE installation package:

Pay special attention to the hook Add Python 3.6 to PATH , then click "Install Now" to complete the installation.

Video Demo:

Run Python

After the installation is successful, there are two situations when you open a command prompt window and type python:

Situation One:

See the above screen, it shows that Python installation success!

You see the prompt indicates that we are already in the >>> Python interactive environment, you can enter any Python code, carriage return will immediately get the result of execution. You can now exit() exit the Python interactive environment by entering and returning to the command-line window.

Situation two: Get an error:

‘python’ 不是内部或外部命令,也不是可运行的程序或批处理文件。

This is because Windows will be based on a Path path set by the environment variable to find python.exe , if not found, will be an error. If you omit the tick when you install Add Python 3.6 to PATH it, manually python.exe add the path you are in to path.

If you do not know how to modify the environment variables, it is recommended to run the Python installer again, be sure to remember the hook Add Python 3.6 to PATH .

Summary

Learn how to install Python on your computer and be familiar with opening and exiting the Python interactive environment.

When you run Python on Windows, start the command line first, and then run it python .

When you run Python on Mac and Linux, open the terminal and run it python3 .

Python Basic python Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.