Setting up python3 environment under Linux

Keywords: Python Linux yum OpenSSL

python3 environment construction under Linux

What are the ways to install Linux software?

  • The manual installation of rpm package rejects this mode, and the dependency needs to be resolved manually
  • yum automatic installation is very easy to handle dependency automatically
  • Source code compilation and installation, more customizable functions, specify software installation path
  • Download binary source code. The software has been compiled and installed, and the executable file has been upgraded
    • Download the compression package, and decompress it directly.
Build install python3 step
1.Install the compilation environment,  golang  Compile and run the code first, python It's direct operation, c Language is also run after compilation, which requires gcc compiler

yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
2.Obtain python Source code of, download and install
opt File is a directory for downloading large files. We should cd reach opt Directory python Download of
wget https://www.python.org/ftp/python3.6.3/Python3.6.3.tgz

3.After downloading the source code package, decompress it
tar -zxvf Python-3.6.3.tgz

4.After decompressing, the python3.6.3 Enter the source directory to start compiling
cd Python-3.6.3
5.At this time, you are ready to compile the trilogy. The first one: specify python3 The following command is used to monitor the system development environment
#Command interpretation
#configure is a script file that tells the gcc compiler where Python 3 is going to be installed and checks the underlying development environment. Check openssl, sqlite, etc
#After the first compilation, makefile s are mainly generated for compilation.

./configure --prefix=/opt/python363/

#The second area of compilation starts software compilation
//Just input the make command directly

#Compile the third song, compile and install, and generate the executable program of python3, which can be generated as / opt/python363/
make install

#The compiled second and third songs can be abbreviated as make && make install  #On behalf of make success, continue with make install

6.Wait for the following results, indicating python3 The compilation and installation are finished
Successfully installed pip-9.0.1 setuptools-28.8.0

7.You can now check python3 Executable directory.

8.To configure PATH Environment variable, permanently modified PATH,Add to Python3 Of bin Directory in start position
vim /etc/profile
//Write the following
PATH="/opt/python363/bin:/usr/local/sbin:/usr/local/bin:/sur/sbin:/usr/bin:"
9.Manual read/etc/profile,Load all the cars in the file
source  /etc/profile

10.inspect python3 , and pip3 The absolute path of.
[root@localhost etc]# which pip3
/opt/python363/bin/pip3
[root@localhost etc]# which python3
/opt/python363/bin/python3
[root@localhost etc]# 

Posted by jamesjohnson88 on Wed, 22 Apr 2020 09:29:48 -0700