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

Analysis of CentOS7.5 installation Python3.6.6 instance

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces CentOS7.5 installation Python3.6.6 instance analysis related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe everyone will have a harvest after reading this CentOS7.5 installation Python3.6.6 instance analysis article, let's take a look at it.

Installing dependencies that may be required

yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel

Download zip pack

Get download link

Here we select python 3.6.6 from python official website, download address is as follows

https://www.python.org/ftp/python/3.6.6/python-3.6.6.tar.xz

The viewer can also choose his own version, the official ftp is

https://www.python.org/ftp/python/

Download zip pack

Now we go into centos (the directory can be ignored at this time) and the command is as follows

wget https://www.python.org/ftp/python/3.6.6/python-3.6.6.tar.xz

Download complete Go to the next step

Decompress the compressed package

Mobile compressed package

I personally like to install python in/usr directory, we first move python compressed package to the specified folder, we need to use mv command to move

MV's current location moved location

mv /root/python-3.6.6.tar.xz /usr/

entered the catalogue

We use cd command to go to the target folder and ls command to view all files in the folder

cd /lscd usr/ls

We can see that it has moved successfully

decompression

Unpack tar.xz Use the xz -d command to extract the tarpack

xz -d python-3.6.6.tar.xz

We'll use ls again to see

We extract the tar package again, using tar command

tar -xvf python-3.6.6.tar

The screen scrolls quickly and the decompression is complete

We can see that there is already a python-3.6.6 directory

Install Python

Let's go into Python first.

cd python-3.6.6/

add configuration

In fact, it is to install python compilation into the specified directory, which is specified as/usr/python.

./ configure --prefix=/usr/python

ps: If there is an error (below), you need to install gcc first

yum install -y gcc

correct result

compile and install

Use the make command

make

And then you have to wait

Use the make install command when finished

make install

waiting

If zlib errors occur (see below), you need to install zlib first and then reinstall it.

yum -y install zlib*

If ctypes error occurs, you need to install libffy first

yum install libffi-devel -y

Python installation complete screenshot

At this point we first return to the upper directory, if you see the python folder on behalf of success, if you lack dependencies in the compilation installation may appear no folder, then you need to add configuration again

Create soft links

Creating soft links is equivalent to configuring environment variables

ln -s /usr/python/bin/python3 /usr/bin/python3

At this point, we can enter python by typing python 3 in any directory.

Let's test the import_ssl

Perfect!

We also need to configure pip soft links to use pip

ln -s /usr/python/bin/pip3 /usr/bin/pip3

Install pymysql test using pip3

About "CentOS 7.5 installation Python 3.6.6 instance analysis" The content of this article is introduced here, thank you for reading! I believe that everyone has a certain understanding of the knowledge of "CentOS 7.5 Installation Python 3.6.6 Instance Analysis". If you still want to learn more knowledge, please pay attention to 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

Internet Technology

Wechat

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

12
Report