In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
One-click execution
Install the python3.8 environment with one click on the virtual machine, simply change the network adapter to nat mode (make sure the host has access to the Internet), then put the tar package in the / root directory and execute the script.
The script first uninstalls the original python2.7 environment of the system, then automatically changes the way of obtaining the address of the network card to dhcp, checks the network connectivity, changes the domestic yum source, then installs the python3.8 environment, finally installs python3.8, and prompts for friendly output after the installation is completed.
Download and share the tar package directly, including the python3.8 version of the tar package and script files.
Links: scripts and their tar packages
Extraction code: 4b6w
Content of the script:
#! / bin/bashecho "put the tar package of python under the / root/ directory when using" read-p "this script requires networking. If it is a virtual machine, please change the network adapter to nat mode"-t 2echosed-I "s/BOOTPROTO=static/BOOTPROTO=dhcp/" / etc/sysconfig/network-ifcfg-ens33ifdown ens33ifup ens33systemctl start network & > / dev/nullsystemctl restart network & > / dev/nullif [$?-eq 0] Thenip= `ifconfig ens33 | awk 'NR==2 {print $2}' `echo "obtained the IP address successfully, but failed to obtain the address with the address of $ip" elseecho ". Please check the network situation by yourself" exit 1fiping-c 3 www.baidu.com & > / dev/nullif [$?-eq 0] Thenecho "Network connection succeeded, start execution of subsequent code" elseecho "Network connection failed Please check whether the address can be used "exit 1ficd / etc/yum.repos.d/rm-rf * wget http://mirrors.163.com/.help/CentOS7-Base-163.repo & > / dev/nullyum clean all & > / dev/nullyum makecache & > / dev/nullyum install gcc patch libffi-devel python-devel zlib-devel bzip2-dnssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-4-devel libpcap-devel xz-devel-y & > / dev/nullecho" to build domestic Yum sources successfully. Starting to install the python environment "cd / root/tar zxf Python-3.8.0a2.tgz & > / dev/nullcd Python-3.8.0a2/./configure-- prefix=/usr/local/python_3.8 & > / dev/nullif [$?-eq 0] Thenecho "environment installation completed, configuring python3.8" elseecho "environment installation error, please check whether all dependent packages are installed" fimake-j 4 & > / dev/nullmake install & > / dev/nullln-s / usr/local/python_3.8/bin/* / usr/bin/echo "python3.8 installation is complete, located at / usr/local/python_3.8"
Execution effect:
Note: the following is the effect of connecting the terminal. If executed in the virtual machine, the Chinese will be displayed as a small white box, but it will not affect its operation.
[root@test2 ~] # sh python3.8_install.sh
Put the tar package of python into the / root/ directory when using it.
This script needs to be networked. If it is a virtual machine, please change the network adapter to nat mode
IP address obtained successfully, address is 192.168.125.130
The network connection is successful, start to execute the subsequent code
The domestic Yum source has been successfully built, and the installation of python environment is under way.
Environment installation complete, configuring python3.8
Python3.8 installation completed, located at / usr/local/python_3.8
After the installation is complete, the test uses
[root@test2 ~] # python3Python 3.8.0a2 (default, Mar 29 2020, 19:45:00) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linuxType "help", "copyright", "credits" or "license" for more information. > > print ('hello') hello > # Ctrl+d exit
Summary
This is the end of this article on using shell scripts to install the python3.8 environment in CentOS7. For more information about centos7 installation and python3.8 environment, please search for previous articles or continue to browse the relevant articles below. I hope you will support it in the future!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.