Summary of Linux automation environment installation issues

Python installation

1. Download python3

wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

2. Decompress

[root@mycentos ~]# tar -xzvf Python-3.7.0.tgz

First create a compilation directory:

[root@mycentos ~]# mkdir /usr/local/python3

The Python3.7 version requires a new package libffi-devel. After installing this package, compile and install it again.

[root@mycentos ~]# yum install -y libffi-devel

Then compile and install:

[root@mycentos ~]# cd Python-3.7.0

[root@mycentos ~]# ./configure --prefix=/usr/local/python3

[root@mycentos ~]# make

[root@mycentos ~]# make install

Create a soft link:

[root@mycentos ~]# ln -s /usr/local/Python3/bin/python3 /usr/bin/python3

View version:

[root@mycentos ~]# python3 -V

Python 3.7.0

When installing setuptools after installing python, I get the error Compression requires the (missing) zlib module. The reason is missing zlib module.

Solution:

1. If zlib is not installed, install zlib first.

1.Install zlib module

yum install -y zlib

yum install -y zlib-devel

2. After the installation is complete, find the directory where zlib is located.

3. Enter the Python source code directory to recompile Python, such as zlib.sh under /usr/include:

./configure --prefix=/home/xxx/Python2.7 --with-zlib=/usr/include
make && make install
  1. After compilation and installation, the zlib module can be introduced in python.

C. Install setuptools and pip

pip is a tool for quickly installing third-party python packages. It will make it extremely convenient for us to install third-party python packages. Its function is just like yum in the centos system. For the use of pip, please refer to the pip manual .

pip depends on setuptools, so setuptools must be installed before installing pip.

Install setuptools:

tar -zxvf setuptools-xx.tar.gz

cd setuptools-xx

python setup.py build

python setup.py install

Install pip:

tar -zxvf pip-xx.tar.gz

cd pip-xx

python setup.py build

python setup.py install

If there is still no pip command after pip installation, you need to add environment variables.

# vim /etc/profile

At the end of the document, add:

export PATH="/usr/local/python2.7/bin:$PATH"

Save and exit

Then run:

#source /etc/profile

Under linux environment

First, clarify the cause of the problem. It is because the openssl version is too low or does not exist so:

Check the openssl installation package and find that the openssl-devel package is missing. 

[root@localhost ~]# rpm -aq|grep openssl 

openssl-0.9.8e-20.el5 

openssl-0.9.8e-20.el5 

[root@localhost ~]#

yum install openssl-devel 

[root@localhost ~]# yum install openssl-devel -y 

View installation results 

[root@localhost ~]# rpm -aq|grep openssl 

openssl-0.9.8e-26.el5_9.1 

openssl-0.9.8e-26.el5_9.1 

openssl-devel-0.9.8e-26.el5_9.1 

openssl-devel-0.9.8e-26.el5_9.1

Recompile and install python3.6, and use the following process to achieve compilation and installation:

cd Python-3.6.4

./configure --with-ssl

make

sudo make install

Guess you like

Origin blog.csdn.net/q_syh/article/details/131518140