SoFunction
Updated on 2024-11-13

Ways to achieve coexistence between python2 and python3

1. Now my local system has built-in python 2.6.

2. Download for source code installation

Copy the link to download to /root/mypackage, unzip it

go on to do sth

mkdir /usr/local/python3

Then execute the following command in the extracted folder to specify the installation path

./configure --prefix=/usr/local/python3

after that

make

go on to do sth

make install

Note: If there is an error in the middle, try again!

Go to the installation path to see the following

Looks like there's no need to change the file name.

Create a soft link, since you can't use commands directly from this directory

ln -s /usr/local/python3/bin/python3 /usr/bin/python3[/code][code]ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

The next step is testing:

summarize

The above is a small introduction to python2 and python3 to achieve coexistence of methods, I hope to help you, if you have any questions please leave me a message, I will promptly reply to you. Here also thank you very much for your support of my website!