Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Python programming environment in different operating systems

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to install Python programming environment in different operating systems. I think it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.

Python is a cross-platform programming language, which means it can run on all major operating systems, so the operating systems we are familiar with include: Windows, MacOs, Linux. So what we are going to talk about today is how to successfully install python in each operating system.

First, set up Python programming environment in Windows system.

01. download

Go to the Python official website, as shown in the figure, click the download indicated by the arrow, or click the download page in the red box to select the version corresponding to your operating system.

02. Installation

The windows version of the Python installation package is an installation package with the suffix .exe. If not, check that you downloaded the correct version.

The bottom two selection boxes are all ticked

Click this option to proceed to the next step

Check all, click Next, and go to the next step.

It is recommended to tick all, or press the default installation, change the installation path, click Install to install

Open the command line tool and enter python to verify the installation. The following prompt indicates that the installation is successful.

C:\ Users\ Administrator > python

Python 3.7.1rc2 (v3.7.1rc2:6c06ef7dc3, Oct 13 2018, 15:44:37) [MSC v.1914 64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.

> > >

Install the Python programming environment in the Linux system

We use Ubuntu to explain the Linux system.

Linux system must be very familiar to programmers, if you also want to be a qualified programmer, I hope you start to use and learn the Linux operating system, the Linux system has been installed by default Python.

01. Python2.7 and python3.6.6 versions are already built into the Ubuntu18.04 version of the system, so we don't need to install them separately.

Verification: open the terminal, enter python to see if the python2.7 version information is returned, then enter exit () to exit, and enter python3 again to see if the python3.6.6 version information is returned.

If you don't have Python 3 installed on your system, or if you want to install a newer version of Python 3, just execute a few commands. We use a package called deadsnakes, which makes it easy to install multiple versions of Python:

$sudo add-apt-repository ppa:fkrull/deadsnakes

$sudo apt-get update

$sudo apt-get install python3.7

These commands install Python 3.7on your system. Please open the terminal and type python3 to verify your installation.

3. Install Python in macOS X system

Python is already built into most macos x systems, but you may find that this is not the latest version. If you want to keep up with the times and install the latest version of python, please make sure which version of python is installed first.

A.1 determine which version has been installed

Open a terminal window and execute the following command:

$python-version

Python 2.7.6

Check the return message to determine your Python version number.

You should also try to execute the command python3-- version, which may get an error message because your system does not have a version of python3 installed, but it is necessary to determine which versions of Python are installed.

A.2 use Homebrew to install Python 3

If your system only has Python 2 installed, or if you have installed an older version of Python 3, you can use a package called Homebrew to install the latest Python 3 version.

1. Install Homebrew

Homebrew depends on the Apple package Xcode, so open a terminal window and execute the following command:

$xcode-select-install

Click the OK button in the constantly appearing confirmation dialog box (this may take some time depending on the speed of the network connection). Next, install Homebrew:

$ruby-e "$(curl-fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This command can be found on the home page of the Homebrew website (http://brew.sh/). Be sure to include a space between curl-fsSL and URL.

Note: the-e in this command causes Ruby (Homebrew is written in this programming language) to execute the downloaded code. Do not run such a command unless the source is something you trust.

To confirm that Homebrew is installed correctly, execute the following command:

$brew doctor

Your system is ready to brew.

The above output shows that you can use Homebrew to install the Python package.

two。 Install Python 3

To install the latest version of Python 3, execute the following command:

$brew install python3

Let's check which version is installed using this command:

$python3-version

Python 3.6.6

$

Now you can use the command python3 to start the Python 3 terminal session, and you can use the command python3 to configure the text editor to run the Python program using Python 3 instead of Python 2.

The above is how to install the Python programming environment in different operating systems. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report