Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Multi-version switching python

Shulou Source: shulou.com Published: 2022-06-03 05:54:14 11月14日 Update

Download the Python installation package from the official website: https://www.python.org/downloads/mac-osx/

Mac os comes with python, but I remember it was the python2.7 version

Avoid using too new versions when choosing to install packages.

Configure the environment:

$vi ~ / .bash_profile

Add the following configuration

# python Set

# Setting PATH for Python 2.7

# The original version is saved in .bash _ profile.pysave

PATH= "/ Library/Frameworks/Python.framework/Versions/2.7/bin:$ {PATH}"

Export PATH

# Setting PATH for Python 3.3

# The original version is saved in .bash _ profile.pysave

PATH= "/ Library/Frameworks/Python.framework/Versions/3.3/bin:$ {PATH}"

Export PATH

Exit after saving

Configure bashrc

$vi ~ / .bashrc

Add the following configuration:

# python alias definition

Alias python2='/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'

Alias python3='/Library/Frameworks/Python.framework/Versions/3.3/bin/python3.3'

Alias python=python3

The environment takes effect:

$source ~ / .bash_profile

$source ~ / .bashrc

View the current python version

$python-V

Python 3.3.5

Switch version

Modify the last line

Change alias python=python3 to alias python=python2

Again $python-V

Python 2.7.11rc1

Installation paths for different versions:

The Mac system comes with Python2.7, and when we install Python3, we can install it through the brew command or pkg on the official website. After installation, their file saving paths are as follows:

Source python installation path

System default / System/Library/Frameworks/Python.framework/Versions/2.7

Brew installation / usr/local/Cellar/python

Official website pkg installation / Library/Frameworks/Python.framework/Versions/2.7

Python version:

Status of Python branches

Branch

Schedule

Status

First release

End-of-life

Release manager

Master

PEP 569

Features

2019-10-20

2024-10

"ukasz Langa

3.7

PEP 537

Bugfix

2018-06-27

2023-06-27

Ned Deily

3.6

PEP 494

Security

2016-12-23

2021-12-23

Ned Deily

2.7

PEP 373

Bugfix

2010-07-03

2020-01-01

Benjamin Peterson

3.5

PEP 478

Security

2015-09-13

2020-09-13

Larry Hastings

3.4

PEP 429

End-of-life

2014-03-16

2019-03-19

Larry Hastings

The official explanation is that version 2.7 will stop maintenance by 2020 and retire from then on, so 3.x is a good choice.

Many testing frameworks rely on python, such as interface testing, front-end web UI, mobile appium, etc., as well as many web development frameworks such as Flask, Django and so on. Python also has a good performance in artificial intelligence, cloud computing, big data and so on.

The elegance, simplicity and clarity of python are unmatched by other languages. choosing the version you need provides a basic guarantee for future work.

Today's recommended reading articles are recommended

Why do interface testing?

JMeter database operation

Jmeter Interface Test-regular expression

JMeter returns garbled code in Chinese

Jmeter interface testing-parameterization

JMeter Interface testing-Basics

Test-impression

Add Wechat to the consulting work

scan a QR code

Welcome self-recommendation and recommendation, need Wechat to push resume!

Please poke the QR code below to learn more.

Tags: Version test interface configuration path recommendation selection good foundation data time framework environment system 2D QR code work switching different elegant Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi Docker OPPO Reno MySQL