Teach you step by step how to install python environment Mac Windows

Hello everyone, my name is Ning Yi.

Python installation is the first hurdle for Xiaobai to learn Python.

Each of us has a different computer environment. With the same steps, my computer has no problems at all, but your computer may have various problems.

Most of the popular programming teachings now directly omit the step of installing Python, and directly type the code in the environment they have set up.

It seems simple, but since you are determined to learn programming, you must step through all the pitfalls of the installation environment yourself. If you don't step on it now, you will have to step on it in the future. You can't escape this thing.

Table of contents:

1. Windows system installation

2. Mac system installation

3. Install IDE code editor

1. Windows system installation

(1) Download the Python installation package

download link:

http://www.python.org/download/

You will see this page, just download the latest version of the current stable version of Python 3. I wrote this class on May 20, and the latest stable version is 3.9.13.

(2) Install Python

The name of the downloaded installation package is: python-3.9.13-amd64.exe. We double-click to install, and the following page will appear. Be sure to check the Add Python 3.9 to PATH option first, and then click to install, so that you do not need to configure the environment. Configured.

Next, keep the default options and keep clicking Next.

If the Add Python 3.9 to PATH option is not checked, remember to check it after reinstalling it and it will be ok.

(3) Verify installation

Open the terminal (click to start searching cmd) and enter python.

Situation 1: If the Python version and prompt >>> appear, it means the installation is successful and we are now in the Python interactive environment.

Situation 2: If an error occurs, it is usually because the environment has not been configured, that is, the Add Python 3.9 to PATH option was not checked during installation. Remember to check it after reinstalling and it will be ok.

2. Mac system installation

The Mac system comes with the Python 2.7 version. Our course uses the Python 3 version. There are many incompatibilities in the Python 2 and Python 3 codes. Python 3 is also a later application trend, so we still need to install the Python 3 version on the Mac computer.

Note: Do not uninstall the Python2.7 version. Many programs in the system depend on it to run. Python2 and Python3 versions can exist at the same time.

(1) Get the Mac system version

Click "Apple Icon" -> "About This Mac" to check the system version, and write down your Mac version.

(2) Download the Python installation package

download link:

http://www.python.org/download/

You will see the following page. We can just download the latest version of the current stable version of Python 3. I wrote this class on May 20, and the latest stable version is 3.9.13.

There are two download options, how to choose?

If the mac version is MacOS 10.9.0-10.15.7, download the macOS 64-bit Intel-only installer

Otherwise download the macOS 64-bit universal2 installer.

(3) Install Python

After the download is complete, double-click the installation package, keep the default option, and keep clicking to continue.

(4) Verify installation

Open a terminal (launchpad search terminal), type python3.

The above Python version and the prompt >>> appear, which means that the installation is successful, and we are now in the Python interactive environment.

3. Install the code editor IDE

After configuring the Python environment, we also need to install an editor so that we can edit Python files.

The code editor is actually similar to word. We can use the txt that comes with the system to edit text, but office is more convenient and more powerful.

The same goes for the code editor. The system comes with an IDE, which is inconvenient for us to operate, so we install one ourselves. I use Sublime. I will teach you how to install it below.

download link:

http://www.sublimetext.com/3

Download the version that suits your computer environment. After downloading the installation package, just install it like normal software. There is nothing to pay special attention to.

Sublime3 is a very simple software. You can also install various plug-ins to assist operations if needed. PyCharm is also very popular now. You can use it if you want to. Just choose a code editor that suits you.

Click to follow and get started with Python without getting lost~

Guess you like

Origin blog.csdn.net/shine_a/article/details/125901427