程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Deploy centos8 and install python2.7 (dolphin scheduler 1.2.1 executes dataX and reports that python2.7 does not exist)

編輯:Python

Deploy centos8 And installation python2.7

  • background
  • install centos8.0.1905
    • Download address
    • adopt VirtualBox Installation
      • Configure static IP
      • To configure xshell Connection tool
  • install python2.7
    • Test whether it is connected to the Internet
    • Verify that the environment is consistent with the production environment
    • install python2.7
      • download python2.7
      • install python2.7
        • Report errors
          • no acceptable C compiler found in $PATH
          • Cache failed
          • Cache failed , Ignore this repo. Metadata cache established .
          • To verify again
      • Installation dependency
          • No matching parameters found : gcc
      • Reconfiguration python2.7
        • To configure
        • compile
          • Can't find make command ( It's too hard )
          • make Failure
            • The last struggle
  • final result

background

Execute through dolphin scheduling datax During the mission , Report errors python2.7 The order does not exist .
The reason is that the version specified by the code is 2.7, and centos8 Own is python3 edition .
There are two solutions :
One : Replace with python3
Replacement needs to be modified datax/bin Below python file , Colleagues say it's easier , Modify the datax.py in print Just grammar , Add parentheses , additional py file
In less than .
Two : install python2.7
Tried to install , It was simple , But keep reporting the wrong , Therefore, this article also imitates the production environment to install centos8 virtual machine , Repeat the question , And try to solve .

Report errors

Operating system and python edition
Input python The command does not exist ,/usr/bin Not below python Soft link , Only python3 and python3.6 link

1.2.1 Code

install centos8.0.1905

Download address

8.0.1905 64 position
Obviously download the biggest iso file

adopt VirtualBox Installation

New machines

Default in C disc , It is recommended to put other disks , My side C The disk is relatively large , Just put C disc , It will be installed at that time , Exporting a copy for backup is the same .

It may be deployed later dolphinscheduler2.0, So the memory should be as large as possible , You can set 1G, It can also be modified later .

All the way to the next step , The recommended size is greater than 10G
iso File size , Yes 6G

Set up - Image file


Network select bridge mode

Start creating user
Click start , Come to the setup page in a few minutes , Follow the prompts to configure step by step

Where can I click to confirm

Close it and try again

After closing , The result is to do it again , But this time the display is normal

Restart and continue the installation , endless …
Then he forced himself out , Remove the optical drive , Start again , Finally, the dead circle is over


Then pop up license authentication , Click on , Installation Tips , Select optical drive , Complete the configuration

Log in
Looking at the graphical interface is strange …

Configure static IP

Ctrl+Alt+F3 Switch to the command line page (Ctrl+Alt+F1 Switch back to the GUI )

virbr0 network card , Because the system was installed with libvirt service , Automatically generated , It has a fixed default IP Address 192.168.122.1, Be on the safe side , Finally, delete libvirt service , prevent IP Conflict .
The delete command

yum remove libvirt-*

remove libvirt after , Configure static IP

BOOTPROTO=static
ONBOOT=yes
PREFIX=24
IPADDR=192.168.1.66
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
DNS1=114.114.114.114

restart

verification

To configure xshell Connection tool

install python2.7

Test whether it is connected to the Internet

Mode one

curl https://www.baidu.com/


Mode two

ping www.baidu.com


The Internet is connected , Unfortunately, it doesn't work , Because the production environment is not connected to the Internet … Now OCD is getting worse !!!!!

Verify that the environment is consistent with the production environment

x86_64
[[email protected] ~]# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.66 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::cf9b:a0e3:955b:4cff prefixlen 64 scopeid 0x20<link>
ether 08:00:27:ae:4d:ad txqueuelen 1000 (Ethernet)
RX packets 483 bytes 60582 (59.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 278 bytes 28454 (27.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[[email protected] ~]#
[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
[[email protected] ~]# uname -m
x86_64
[[email protected] ~]# python
bash: python: Command not found ...
[[email protected] ~]# python3
Python 3.6.8 (default, May 21 2019, 23:51:36)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
[[email protected] ~]#

install python2.7

download python2.7

python2.7.6

Too slow …

Upload to server

install python2.7

decompression - To configure - compile

[[email protected] ~]# # Create build directory
[[email protected] ~]# mkdir -p /usr/local/python2.7
[[email protected] ~]# # Unzip the installation package
[[email protected] ~]# tar xf /tmp/Python-2.7.6.tgz
[[email protected] ~]# # Go to unzip directory , To configure , Specify the compile Directory
[[email protected] ~]# cd Python-2.7.6/
[[email protected] Python-2.7.6]# ./configure --prefix=/usr/local/python2.7


It turned out to be wrong , There is no error in the production environment , The installation of the production environment is very smooth , Is to report an error when executing an order

Report errors

no acceptable C compiler found in $PATH
[[email protected] Python-2.7.6]# ./configure --prefix=/usr/local/python2.7
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for --enable-universalsdk... no
checking for --with-universal-archs... 32-bit
checking MACHDEP... linux2
checking EXTRAPLATDIR...
checking for --without-gcc... no
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/Python-2.7.6':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
[[email protected] Python-2.7.6]# less config.log
[[email protected] Python-2.7.6]#

terms of settlement , install gcc

yum -y install gcc
Cache failed


terms of settlement
Backup , Then release the address and change it to Alibaba cloud address , All three documents need to be changed

[[email protected] Python-2.7.6]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.bak
[[email protected] yum.repos.d]# cp CentOS-AppStream.repo CentOS-AppStream.repo.bak
[[email protected] yum.repos.d]# cp CentOS-Extras.repo CentOS-Extras.repo.bak
[[email protected] yum.repos.d]# vi CentOS-Base.repo
[[email protected] yum.repos.d]# vi CentOS-AppStream.repo
[[email protected] yum.repos.d]# vi CentOS-Extras.repo

example :

name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
baseurl=https://mirrors.aliyun.com/centos/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

Base

APP

Extras

Cache failed , Ignore this repo. Metadata cache established .


The reason is that the address is wrong , First, make sure the address is correct , Then replace and try again

https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/


Replace address

[[email protected] yum.repos.d]# grep aliyun CentOS-*
CentOS-AppStream.repo:baseurl=https://mirrors.aliyun.com/centos/8-stream/AppStream/x86_64/os/
CentOS-Base.repo:baseurl=https://mirrors.aliyun.com/centos/8-stream/BaseOS/x86_64/os/
CentOS-Extras.repo:baseurl=https://mirrors.aliyun.com/centos/8-stream/extras/x86_64/os/

To verify again
[[email protected] yum.repos.d]# # Clear cache
[[email protected] yum.repos.d]# yum clean all
0 File deleted
[[email protected] yum.repos.d]# # Build cache
[[email protected] yum.repos.d]# yum makecache

Installation dependency

The environment is like leaves , The same environment doesn't exist at all , Networking Big head …
Installation successful

yum install -y openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel libffi-devel
No matching parameters found : gcc


Did not find epel resources , Appoint IP that will do

yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm

Re install gcc

yum install -y gcc

Reconfiguration python2.7

To configure

[[email protected] yum.repos.d]# cd
[[email protected] ~]# cd Python-2.7.6/
[[email protected] Python-2.7.6]#
[[email protected] Python-2.7.6]#
[[email protected] Python-2.7.6]#
[[email protected] Python-2.7.6]# ./configure --prefix=/usr/local/python2.7

compile

[[email protected] Python-2.7.6]# make && make install
Can't find make command ( It's too hard )


direct yum install -y make, Installation successful , Finally, it went well !!!!

make Failure
./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
make: *** [Makefile:468: pybuilddir.txt] Segment error (core dumped)

Check the log , Doubt or rely on incomplete installation

Installation dependency g++ (c++), still make Failure

yum install -y gcc-c++

The last struggle

It's two o'clock in the morning , It hurt so much , download 2.7 Try the latest version , OK, it's the last time

decompression 、 To configure

To configure

Heaven has eyes , End of compilation , It just seems …
Looks like it's going to 400, I really want to end , But I dare not

Copy and view log results , Fortunately, the test failed

Finally you can install

final result

Configuration selected ./configure --enable-optimizations So it is not installed in the specified directory , You should put... In the back --prefix=/usr/local/python2.7 Spliced ,--enable-optimizations The function of parameter is not to establish soft connection by yourself

mkdir -p /usr/local/python2.7
/configure --enable-optimizations --prefix=/usr/local/python2.7

If the installation directory is specified , You need to configure the environment variable ,/etc/profile It's for all users , Individual user configuration in .bash_profile in

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

python3 Also unaffected

It's too hard , One is to find the image , It took a long time , Then is python make It took too long , The ultimate solution is to download the latest 2.7 edition , Ha ha! !


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved