Centos7 上安装python3 & yum 和 firewall 报错的相关处理

Centos7 误删python导致yum和firewall异常使用问题 离线方式处理 Centos 误删python导致yum异常使用问题 离线方式处理问题描述离线处理方案 问题描述 误删python,yum使用异常,重新安装python tar -zxvf Python-2.7.5.tgz cd Python-2.7.5 ./configure --prefix=/usr/local/python27 make&&make install ln -s /usr... 阅读详情
  1. centos 上自带python2.7
  2. 在python 官网下载python安装包https://www.python.org/downloads/
  3. 通过xshell 上传安装包到/usr/local/src 的路径下
  • 安装python所需的依赖包:
  • yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
  • 创建目录来存放源码
  • makedir -p /usr/local/python3
  • 解压python源码包到 /usr/local/src 的目录:
  • tar -xzvf Python-3.4.10.tgz -C /usr/local/src/
  • 进入源码包目录:
  • 编译安装
  • make && make install
  • 配置环境变量,在.bash_profile 中配置python3的环境变量
  • 添加如下红圈的一行
  • source ~/.bash_profile 让上面的设置生效
  • 建立python3 的软连接
  • 如下图,自带的python2.7 中的软连接如下,输入python、python2、python2.7都可以进入python2的环境
  • 现在要修改让输入python 就指向python3
  • rm /usr/bin/python
  • ln -s /usr/local/python3/bin/python3  /usr/bin/python
  • /usr/local/python3/bin/python3 就是上文中安装源码的路劲,后面的/usr/bin/python 中/usr/bin 是固定的,python 是可以自己命名的,假如是/usr/bin/aaa    那么输入aaa 也可以进入python3 中

         

 

yum 和 firewall 报错的原因及相关处理

yum 和firewall 中的相关文件中都是指向的python2 ,所有在安装了python3后要指向原来的python2

修改yum的python指向:

vi /usr/bin/yum 修改python的指向

#!/usr/bin/python2.7

修改urlgrabber-ext-down文件的python的指向

#!/usr/bin/python2.7

修改firewall中的python指向:

 vi /usr/bin/firewall-cmd

 #!/usr/bin/python2.7

/usr/sbin/firewalld

#!/usr/bin/python2.7

 

 

 

 

 

 

 

CentOS 7 下通过 yum 安装 Tomcat 7 的完整实践指南 Tomcat 是 Java Web 应用最主流的 Servlet 容器,而 CentOS 7 作为长期支持的 Linux 发行版,广泛用于政企内网、教学实训与遗留系统运维。尽管 Tomcat 7 已结束官方维护,其在 JDK 8 兼容性、SELinux 策略支持和系统级包治理方面仍具不可替代性。yum 作为 RPM 包管理核心工具,提供可审计、可回滚、依赖自动解析的部署能力,远超手动解压方式。本文聚焦 CentOS 7 环境下,如何借助 Software Collections(SCL)仓库安全启用 rh- 阅读详情

相关推荐

python3-slip-dbus-0.6.4-11.el8.noarch.rpm

官方离线安装包,亲测可用

安装完python3版本后,防火墙无法启动firewalld.servicefailedbecausethecontrolprocess

Job for firewalld.service failed because the control process exited with error code. See “systemctl status firewalld.service” and “journalctl -xe” for details.(更换python2 更换成 python3 后) 只需要修改文件三个 /usr...

梦游娃娃的博客 2101

Mplus实战:三变量随机截距交叉滞后模型(RI-CLPM)语法详解与扩展

本文详细解析了Mplus中三变量随机截距交叉滞后模型(RI-CLPM)的构建原理与语法实现。通过将变量分解为稳定的个体间差异与动态的个体内波动,模型能更纯净地揭示多变量间的纵向交互影响。文章以工作压力、睡眠质量与工作满意度为例,提供了完整的语法模板、关键参数设置(如NOCOV命令、残差相关)及结果解读指南,帮助研究者避开常见误区,稳健分析复杂动态关系。

wdx0123456的博客 921

centos7防火墙无法启动--与安装了python3有关

关闭centos防火墙后无法启动, 使用systemctl status firewalld.service 查看错误信息, 查阅后发现可能是之前把python的链接指向了新安装的python3, 这里推荐安装python3和python2共存的文章:https://www.cnblogs.com/blogjun/articles/8063989.html 修改/usr/sbin/fi...

MartinTeoZhang的博客 661

无人机避障——卡内基梅隆大学(CMU)CERLAB 无人机自主框架复现

CMUCERLAB无人机自主框架是一个模块化的无人机自主导航系统,包含感知、测绘、规划和控制等组件。安装过程中遇到的主要问题包括:(1)cv_bridge路径未正确识别,需手动指定路径;(2)OpenCV版本冲突(4.2与4.6),导致动态导航节点崩溃。解决方案包括:完全卸载OpenCV4.2,重新编译安装OpenCV4.6,并修改相关CMakeLists文件指定版本。最终成功运行仿真环境,实现无人机在Gazebo和RViz中的自主避障导航功能。

weixin_45390670的博客 1637

最新测算源码PHP算命源码-风水八字-八字起名-塔罗牌占卜

未来,随着技术的发展和用户需求的变化,我们可以继续对系统进行升级和优化,以满足更多用户的需求和期望。数据库设计:创建一个名为bazi的数据库表,包含以下字段:id(自增ID)、name(姓名)、sex(性别)、birth_date(出生日期)、birth_time(出生时间)、bazi(八字结果)。数据库设计:创建一个包含塔罗牌信息的数据库表,如tarot_cards,包含字段:id(塔罗牌ID)、name(塔罗牌名称)、meaning(塔罗牌含义)等。根据操作系统的不同,PHP的安装方法会有所不同。

shanbeizi的博客 2414

yum安装firewalld失败

Linux 安装firewalld 遇到的问题。

qq_38233472的博客 2769

Python广度优先搜索BFS - 蓝桥13届省赛污染海域

请问这片N * M海域中有几块是没被污染的独立海域(没被污染的独立海域是指该块海域上下左右被已污染的海域包围,且N * M以外的海域都为已被污染的海域)有一片海域划分为N * M个方格,其中有些海域已被污染(用0表示),有些海域没被污染(用1表示)。第二行开始输入N行,每行M个数字(数字只能为1或者0,1表示没被污染的海域,0表示已被污染的海域)这块4 * 5的海域,有3块海域(绿色)没被污染,因为每一块的上下左右都被污染的海域包围。输出一个整数,表示N * M的海域中有几块是没被污染的独立海域。

m0_69865359的博客 260

使用apt-get instal 安装报错

server2@ubuntuserver4:~$ sudo apt-get install gedit Reading package lists... Done Building dependency tree Reading state information... Done You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: gedi.

caihuawei123的博客 816

详解Nacos集群搭建

在我们日常的开发当中,用的都是单点Nacos,这种模式,我们自己开发测试玩一玩还可以,但是到了企业的生产环境之下,你还这么玩的话,那肯定是要出大问题了。因为在企业当中,我们更加强调的是高可用,所以在企业的生产环境下,Nacos一定要做成个集群。

博客 1万+

大厂面试:字节跳动大数据面试题及参考答案(10万字长文及多张原理图持续更新)

在 Spark 中,宽窄依赖是用来描述 RDD(弹性分布式数据集)之间的依赖关系的概念。窄依赖是指父 RDD 的每个分区最多被一个子 RDD 的分区使用,即子 RDD 的分区可以通过确定的规则从父 RDD 的分区计算得到,并且不需要跨节点进行数据传输。窄依赖通常可以在一个节点上进行计算,不需要进行数据的 shuffle 操作,因此性能较高。宽依赖是指父 RDD 的一个分区可能被多个子 RDD 的分区使用,即子 RDD 的分区需要通过跨节点的数据 shuffle 操作从父 RDD 的多个分区获取数据。

大模型大数据攻城狮的专栏 1644

centos7.5升级python3 firewall-cmd 和 yum不可用的解决

今天因为要用到mysql5.7,所有安装了一个mysql5.7,但是当用firewall-cmd放开端口的限制时,遇到了报错 Traceback (most recent call last): File "/usr/bin/firewall-cmd", line 24, in <module> from gi.repository import GObject I...

z3111001358的博客 1081

【android bluetooth 案例分析 01】【HiCar 详解 3】【hicar时如何交换Wifi参数的】

如果直接使用 L2CAP(不经过 RFCOMM),会需要额外的协议来保证可靠性,而 RFCOMM 天然支持。BLE 广播的数据长度受限(31 字节 / 255 字节扩展),不适合传输复杂的 Wi-Fi 连接参数。使用 RFCOMM 传输参数,可以兼容不同厂商的车机和手机,而无需依赖特殊的蓝牙功能。手机解析这些参数,并使用 Wi-Fi Direct 连接到车机。,然后才能让 Wi-Fi Direct 进行真正的数据传输。,适合传输 Wi-Fi 连接参数等关键数据。,可以安全地交换 Wi-Fi 连接信息。

奔跑吧 android 的博客 1730

centos7 python3.6升级到3.7_Centos7 升级python3,解决升级后不兼容问题

一、确实当前python版本[root@centos Python-3.6.1]# pythonPython 2.7.5 (default, Nov 6 2016, 00:28:07)[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2Type "help", "copyright", "credits" or "license" for more ...

weixin_39972567的博客 2691

PCL 最小生成树用于法向量定向【2025最新版】

PCL 最小代价生成树用于点云法向量的定向。博客长期更新,本文最近更新时间为:2025年9月15日。

点云侠的博客 2062

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

怎么下载python3.7并安装_Centos 7.5安装 Python3.7 并与 yum 共存

1.查看是否已经安装PythonCentOS 7.6 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的是python2.7.5。使用 python -V 命令查看一下是否安装Python[root@localhost ~]# python -VPython 2.7.5然后使用命令 which python 查看一下Python可执行文件的位置:[root@localhost...

weixin_39878855的博客 186

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

centos7安装python3_Centos7安装Python3并兼容Python2的方法

由于centos7原本就安装了Python2,而且这个Python2不能被删除,因为有很多系统命令,比如yum都要用到。[root@VM_105_217_centos Python-3.6.2]# pythonPython 2.7.5 (default, Aug 4 2017, 00:39:18)[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux2T...

weixin_40001309的博客 289

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

centos安装python3的依赖_Centos 7.5安装 Python3.7 并与 yum 共存

1.查看是否已经安装PythonCentOS 7.6 默认安装了python2.7.5 因为一些命令要用它比如yum 它使用的是python2.7.5。使用 python -V 命令查看一下是否安装Python[root@localhost ~]# python -VPython 2.7.5然后使用命令 which python 查看一下Python可执行文件的位置:[root@localhost...

weixin_39777497的博客 268

Centos7 安装python3 与 pip

查看现有python [su@master ~]$ whereis python python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python.bak /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/p...

suzhaoxin123的博客 262

python3.7.2安装教程不成功_Centos7 安装python3详细教程,解决升级后不兼容问题

一、确实当前python版本[root@centos Python-3.6.1]# pythonPython 2.7.5 (default, Nov 6 2016, 00:28:07)[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2Type "help", "copyright", "credits" or "license" for more ...

weixin_33656445的博客 487

【九】Centos7.3 遇到问题总结

1.yum(大黄狗)下载出错 造成yum(大黄狗)下载出错, 一般是由于python多个版本共存的原因。所以,只需将yum 设置文件固定python 版本即可。 sudo vim /usr/bin/yum 打开,将首行的python 修改为python2.7 vim /usr/libexec/urlgrabber-ext-down 打开,将首行的python 修改为python2....

mrdonghe的博客 266

centos7 firewall-cmd报错No module named gi.repository解决办法

错误如下: [root@finebi_dev ~]# firewall-cmd --state Traceback (most recent call last): File “/usr/bin/firewall-cmd”, line 24, in <module> from gi.repository import GObject ImportError: No module named gi.repository 我这边出现错误的原因是误操作删除默认的python,之后重新安装了pyth

自己学咯aha 6774

Centos7 执行firewall-cmd报错“ModuleNotFoundError: No module named 'gi'”

在Linux Centos安装Python3.6后,为了防止yum不可用,更改了: 第一步:vi /usr/bin/yum  把#! /usr/bin/python修改为#! /usr/bin/python2  第二步:vi /usr/libexec/urlgrabber-ext-down  把#! /usr/bin/python 修改为#! /usr/bin/python2 yum恢复; ...

chenxijie1985的专栏 2329

【解决方法】CentOS7 报错 ModuleNotFoundError: No module named 'gi'

背景 新装的 CentOS7.6 环境,准备做一个测试机,因为是内网做着玩的,装完第一件事就是把防火墙关了,然后安装了其他的开发环境。 问题 今天想打开防火墙测试一个功能的时候,发现报了这样一个错: [root@localhost ~]# firewall-cmd --state Traceback (most recent call last): File "/usr/bin/firewal...

Bottle's Blog 5万+

Linux误删系统自带python2导致yum和firewalld失效解决方法(绝对有效)

Linux误删系统自带python2导致yum和firewalld失效解决方法。

qq_50843126的博客 2394
上一篇: 数据库创建及修改
下一篇: 在apache 上部署Django項目
Auguestsnail
博客等级 码龄13年 1粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值