Simple implementation of upgrading Centos Python2 to Python3
1. Get the Python3 package from the Python official website and switch to the directory /usr/local/src
#wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
2. Use the following command to decompress:
1 xz -d Python-3.5.1.tar.xz 2 tar -xf Python-3.5.1.tar.xz
3. Create a directory --python3.5 in the /usr/local path, which is the installation directory in step 4
$mkdir /usr/local/python3.5
4. Compile and install
$cd /usr/local/src/Python-3.5.1 #./configure --prefix=/usr/local/python3.5 #make all #make install #make clean #make distclean
5. Enter the absolute path of the installation and check whether the installation is successful
$ /usr/local/python3.5/bin/python3.5 -V Python 3.5.1
6. Check the environment variables. When starting python, the search is performed in the order of PATH by default. The python in /usr/bin is Python2.6 at this time.
$echo $PATH /usr/lib/qt-3.3/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/gordon/bin
7. Modify the soft connection and point to python3.5 when starting python
1 备份pythonmv /usr/bin/python /usr/bin/python2.6.6 2 修改软连接 sudo ln -s /usr/local/python3.5/bin/python3 /usr/bin/python
8. Verify whether python3.5 is started by default
$ python -V Python 3.5.1
The above simple implementation of upgrading Centos Python2 to Python3 is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home.

The basic syntax for Python list slicing is list[start:stop:step]. 1.start is the first element index included, 2.stop is the first element index excluded, and 3.step determines the step size between elements. Slices are not only used to extract data, but also to modify and invert lists.

Listsoutperformarraysin:1)dynamicsizingandfrequentinsertions/deletions,2)storingheterogeneousdata,and3)memoryefficiencyforsparsedata,butmayhaveslightperformancecostsincertainoperations.

ToconvertaPythonarraytoalist,usethelist()constructororageneratorexpression.1)Importthearraymoduleandcreateanarray.2)Uselist(arr)or[xforxinarr]toconvertittoalist,consideringperformanceandmemoryefficiencyforlargedatasets.

ChoosearraysoverlistsinPythonforbetterperformanceandmemoryefficiencyinspecificscenarios.1)Largenumericaldatasets:Arraysreducememoryusage.2)Performance-criticaloperations:Arraysofferspeedboostsfortaskslikeappendingorsearching.3)Typesafety:Arraysenforc

In Python, you can use for loops, enumerate and list comprehensions to traverse lists; in Java, you can use traditional for loops and enhanced for loops to traverse arrays. 1. Python list traversal methods include: for loop, enumerate and list comprehension. 2. Java array traversal methods include: traditional for loop and enhanced for loop.

The article discusses Python's new "match" statement introduced in version 3.10, which serves as an equivalent to switch statements in other languages. It enhances code readability and offers performance benefits over traditional if-elif-el

Exception Groups in Python 3.11 allow handling multiple exceptions simultaneously, improving error management in concurrent scenarios and complex operations.

Function annotations in Python add metadata to functions for type checking, documentation, and IDE support. They enhance code readability, maintenance, and are crucial in API development, data science, and library creation.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download
The most popular open source editor

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
