How to install Python on multiple platforms

Source: Internet
Author: User

A recent project, architect Milo needs to use a Python script for Mqtt, when the server was developed. Run Python will need to install the development environment, OK, Baidu a bit to know the great God Liao Xuefeng. The following sections of the test pass, reproduced as follows.

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.

2.x or 3.x

Currently, Python has two versions, One is version 2.x, one is the 3.x version, these two versions are incompatible, because Python is now evolving towards the 3.x version, in the process of evolution, a large number of 2.x version of the code to be modified before it can be run, so there are many third-party libraries are temporarily unable to use on the 3.x.

In order to ensure that your program can use a large number of third-party libraries, our tutorials are still based on the 2.x version, to be exact, version 2.7. Make sure that the Python version installed on your PC is 2.7.x so that you can learn this tutorial without pain.

Install Python on your Mac

If you are using a Mac, the system is OS X 10.8 or the latest 10.9 Mavericks, congratulations, the system comes with Python 2.7. If your system version is below 10.8, you can get Python 2.7 by backing up your system and upgrading to the latest 10.9 for free.

To view the system version, click on the Apple icon in the top left corner and select "About this Mac":

Install Python on Linux

If you are using Linux, then I can assume that you have Linux system management experience, self-installing Python 2.7 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 of all, from the official website of python python.org download the latest version 2.7, the slow speed of the students please step into the domestic mirror.

Then, run the downloaded MSI installation package, and tick all the components when you select the step of the installation component:

In particular, be careful to select pip and Add python.exe to Path , then go all the way "Next" to complete the installation.

The default is to install to the C:\Python27 directory, then open a command Prompt window, after typing python, there are two situations:

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.exe to Path it, manually python.exe add the path you are in C:\Python27 to path.

If you do not know how to modify the environment variables, it is recommended to run the Python installer again, remember to tick Add python.exe to Path .

Summary

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

PostScript: It is best to use the system comes with the add Python.exe to Path function, and later add a very troublesome, the entry into force is not immediately effective. If you forget to check it does not matter, unloading and reloading again.

How to install Python on multiple platforms

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.