基于 CentOS7系统将 Python 2.7升级至3.x

centos7下如何更改默认的pip为pip3,将pip从8提升到23.1.2 如果输出显示类似 "pip x.x.x from /usr/bin/pip3 (python 3.x)" 的信息,则表明默认的 pip 已经被修改为 Python 3.x 版本的 pip。如果你看到类似 "Python 2.7.x" 和 "pip x.x.x" 的输出,则表明 Python 和 pip 已经安装并配置好了。这将会创建一个名为 "pip" 的符号链接,指向 Python 3.x 版本的 pip 可执行文件。确认系统中已经安装了 Python 3.x,并且 pip 已经正确安装并配置。 阅读详情

CentOS 7 默认自带了 Python,但版本比较低,为了使用新版 3.x,就要对低版本进行升级。由于很多基本的命令、软件包都依赖旧版本,比如:yum。所以,在更新 Python 时,建议不要删除旧版本,可以多版本共存。

  • 下载新的python包并安装

进入https://www.python.org,选择需要的版本

yum install gcc gcc-c++ libffi-devel openssl-devel python-setuptools vim wget make sqlite-devel zlib* -y

wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz

tar xvf Python-3.7.1.tar.xz

cd Python-3.7.1

./configure --with-ssl

make

make install

(注: 在./configure过程中,如果没有加上–with-ssl参数时,默认安装的软件涉及到ssl的功能不可用)

  • 设置3.X为默认版本

查看 Python 的路径,在 /usr/bin 下面。可以看到 python 链接的是 python 2.7,所以,执行 python 就相当于执行 python 2.7。

ls -al /usr/bin | grep python

将原来 python 的软链接重命名:

mv /usr/bin/python /usr/bin/python.bak

将 python 链接至 python3:

ln -s /usr/local/bin/python3 /usr/bin/python
  • 配置yum

升级 Python 之后,由于将默认的 python 指向了 python3,yum 不能正常使用,需要编辑 yum 的配置文件。

修改/usr/bin/yum和/usr/libexec/urlgrabber-ext-down

将 #!/usr/bin/python 改为 #!/usr/bin/python2.7

保存退出即可。

centos7 中升级为python3.x 由于python官方已宣布2.x系列即将停止支持,为了向前看,我们升级系统的python版本为3.x系列 服务器系统为当前最新的CentOS 7.4 注:若出现configure: error: no acceptable C compiler found in $PATH,则安装GCC软件套件 [root@localhost ~]# yum install gcc ... 阅读详情

相关推荐

Bigder:Linux centos下python2.7升级到python3.7.3

Linux上python2.7升级到python3.7

软件测试入门&进阶 1431

[Contens7]实操Python2到python3的升级详细过程

1、切换工作目录至/usr/local 在Linux系统下,路径/usr/local相当于C:/Progrem Files/,通常安装软件时便安装到此目录下。 cd /usr/local 2、下载目标python版本压缩包 wget http://npm.taobao.org/mirrors/python/3.8.0/Python-3.8.0.tgz 3、解压压缩包 tar -xzf Python-3.8.0.tgz 4、在当前目录下创建文件夹–python3 mkdir python3 5、编译与

MyNameIsWangYi的博客 4164

INCA软件操作指南:手把手教你生成和解析DCM标定数据文件

本文详细介绍了INCA软件在汽车ECU开发中生成和解析DCM标定数据文件的全流程。从A2L文件导入到DCM文件生成,再到HEX文件导出,手把手教你掌握标定数据处理的实用技巧,包括参数标定、曲线标定和常见问题排查,帮助工程师提升工作效率。

weixin_29271053的博客 1062

centos7中python2.7升级到python3.7

一、下载源码包 切换到root目录 [root@localhost ~] cd /root/ 安装wget [root@localhost ~] yum -y install wget 使用wget下载到目录 [root@localhost ~] wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz 解压 [root@localhost ~] tar xvf Python-3.7.0.tar.xz 二、安装依赖 [root@

耕耘 4554

手把手教你配置SAP EWM HU类型及号段分配(含常见错误排查)

本文详细介绍了SAP EWM系统中HU类型及号段分配的配置方法,包括环境准备、包材主数据配置、存储类型关联及号段管理。通过实战案例和常见错误排查,帮助用户高效完成HU配置,提升仓储管理效率。重点讲解了EWM后台配置和号段配置的关键步骤与技巧。

weixin_33670786的博客 444

Vue3+Element Plus:构建现代化后台管理系统的核心布局实践

本文详细介绍了使用Vue3和Element Plus构建现代化后台管理系统的核心布局实践。从开发环境搭建到核心布局设计,再到动态菜单与路由集成,提供了完整的解决方案和优化技巧。特别适合需要快速开发高效、响应式后台系统的开发者,通过实战案例展示了如何提升开发效率和系统性能。

weixin_28309723的博客 459

centos python2.7升级到3.7_centos python升级_centos python2.7升级到3.7

最近在写一个项目,采集数据的接口是Python3.7写的,服务器上面默认的是2.7,只好对其进行升级,接下来吾爱编程就为大家介绍一下centos python2.7升级到3.7,有需要的小伙伴可以参考一下:1、安装编译环境:yum-yinstallgcc2、下载python3.7.2安装包:wgethttps://www.python.org/ftp/python/3.7.2/Python...

weixin_39854070的博客 1117

cadence——MOS晶体管I-V特性曲线仿真

MOS晶体管I-V特性曲线仿真 目标:使用cadence绘制晶体管的I-V特性曲线(dc仿真) 流程: 新建原理图,将MOS管的栅极电压设为变量Vg,漏极电压设为变量Vd 打开ADEL,点击Variables——Copy From Cellview添加变量;并选择dc仿真,对Vd进行扫描 以Vg作为参变量进行仿真,点击Tools——Parametric Analysis进行设置 选择漏极电流作为输出,进行仿真即可得到I-V特性曲线 ...

skycmq的博客 1万+

Centos7系统Python2.7升级Python3.7(源码编译)

下载安装包# 解压缩。

u011033649的博客 748

浅析ArcGis中的软件——ArcMap、ArcScene、 ArcGlobe、ArcCatalog

ArcMap:是集空间数据显示、矢量数据编辑、冲突数据检查(拓扑检查)、查询检索(地理编码)、统计(字段属性表)、报表生成、空间分析(ArcGIS Spatial Analyst)和高级制图(制图表达)等众多功能干一体的桌面应用平台软件。而且提供所见即所得的符号编辑器,令用户可以随心所欲地生成任意复杂的点、线、面符号。所支持的空间数据格式包括Arclnfo coverages、ESRI shapefiles、ArcSDE lavers、DXF、DWG、DGN、常见的图像格式、GRIDs、TINs等。

lxlmycsdnfree的博客 6568

Cesium实战:全球海洋动态水面与自定义区域波浪效果实现

本文详细介绍了在Cesium中实现全球海洋动态水面与自定义区域波浪效果的实战方法。通过解析核心概念Primitive与Geometry,并深入讲解Water材质的关键参数调节,指导开发者快速创建逼真的动态海洋。文章重点阐述了如何利用多边形坐标定义不规则图形区域,实现精准的局部水域波浪效果,并提供了性能优化与视觉提升的实用技巧。

weixin_29256771的博客 501

CentOS系统中将Python2.7升级到3.X最新版本(3.9.6为例)

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7. CentOS系统中将Python2.7升级到3.X最新版本

码觉客的博客 1万+

ROS2通过ros2_socketcan实现CAN总线高效数据过滤与多节点通信

本文详细解析了ROS2通过ros2_socketcan实现CAN总线高效数据过滤与多节点通信的技术方案。文章重点探讨了CanFilterList的工作原理、多过滤器组合使用及动态配置策略,有效解决了工业应用中CAN总线数据过载问题,显著降低了CPU负载并提升了系统实时性。

n4o5p6q7r的博客 215

CentOS 7 Python2.X升级Python3.X

CentOS7  Python2.X升级Python3.XCentOS7默认安装Python2.X,以我的机器为例子,安装的是Python 2.7.5现在好多Python框架,都已经放出消息,未来版本将不再支持python2。因此,迫切需要我们将原本的Python2升级到Python3。下面将介绍python的升级过程,以及可能遇到的坑。1、首先,下载需要的Python版本。下载地址https:/...

yongchao71 1346

遗传算法(Genetic Algorithm)详解与实现

遗传算法(Genetic Algorithm, GA)是受自然进化原理启发的一系列搜索算法。通过模仿自然选择和繁殖的过程,遗传算法可以为涉及搜索、优化和学习的各种问题提供高质量的解决方案。同时,它们类似于自然进化,因此遗传算法可以克服传统搜索和优化算法遇到的一些障碍,尤其是对于具有大量参数和复杂数学表示形式的问题。

盼小辉丶的博客 24万+

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

python3安装_CentOS7安装Python3.x

CentOS(Community Enterprise Operating System,中文意思是社区企业操作系统)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成。CentOS 7 中默认安装了 Python,但是版本是2.x的,由于2020年python2.x将停止更新,因此需要将版本升级至3.x。但由于python2...

weixin_39658966的博客 126

IEM模型,地表粗糙度模拟

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

centos 7.X 升级 python3(带修复yum)

centos 7.X 升级 python3 centos 7 自带 python2.7,准备升级到python 3,特别注意不要删除系统自带的 python2.X,因为 后续很多组件都依赖这个版本,比如yum。 1. 编译安装可以通过官方网站 https://www.python.org/ 下载最新版本,如果是yum安装可以 通过 yum search python|grep "python3",...

静宁宇思 3932

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Statistics and Machine Learning Toolbox

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

Linux 升级 Python 至 3.x

简述 CentOS 7 中默认安装了 Python,版本比较低(2.7.5),为了使用新版 3.x,需要对旧版本进行升级。 由于很多基本的命令、软件包都依赖旧版本,比如:yum。所以,在更新 Python 时,建议不要删除旧版本(新旧版本可以共存)。 简述 查看 Python 版本号 下载新版本 解压缩 安装配置 编译 安装 验证 设置 3x 为默认版本 配置 yu...

weixin_30578677的博客 4302

Linux环境Python2.7升级Python3

Centos7中默认的Python版本为2.7,在2020年python官方将不再支持2.7版本的python,所以使用3.x版本的python是必要的 下载地址:https://www.python.org/ftp/python 选择一个合适的版本:wget https://www.python.org/ftp/python/***.tgz 默认的Python安装在/usr/bin/pyt...

qq_38836082的博客 3402

Linux下python2.x升级python3.7

一、查看当前python版本 [root@ansible ~]# python -V Python 2.7.5 二、下载新的python包并安装 进入python官网(https://www.python.org),选择需要的版本。此处我选择当前最新版本Python3.6.1 [root@ansible soft]#yum install gcc gcc-c++ -...

weixin_30782331的博客 220

centos下Python2.X升级到Python3.X

在centos6、7上默认都是2.X版本的,如果想升级可以替换原来的Python文件,以下以centos7为例,6上原理一样,6上只能是2.X,如果升到3.X上下左右键会乱码: 首先下载Python3.X版本 wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz 可能会需要一些库文件,这里全都安装了 yum gro...

dodott的专栏 337

CentOS 升级Python2到Python3并且安装 pip正确方式(解决pip: command not found问题)

本文主要介绍在Linux(CentOS)下将Python的版本升级为3.6.2的方法 众所周知,在2020年python官方将不再支持2.7版本的python,所以使用3.x版本的python是必要的,但是linux中默认安装的python一般是2.6和2.7版本的,要是使用linux下的python就很有必要升级一下 进入正题 1.检查确认系统的相关信息 [root@zst...

玖河长久 6383

centos7 python3.6升级到3.7_Centos7下把python 2.7升级到python 3.6(升级过程遇到的一些相关问题)...

Centos 7默认安装的Python的版本是2.7的,现在不少人用的是3.x上的版本,故而需要了解下如何从Python2.7升级到Python 3.6.在虚拟机安装时,网络不通会先遇到一个错误提示 “yum 错误:Cannot find a valid baseurl for repo: base/7/x86_6”,这时先cd /etc/sysconfig/network-scripts/找...

weixin_39838829的博客 657

CentOS 7 升级Python版本为3.x系列

由于python官方已宣布2.x系列即将停止支持,为了向前看,我们升级系统的python版本为3.x系列 服务器系统为当前最新的CentOS 7.4 1.安装前查看当前系统下的python版本号 # python -V 2.获取python3.x的官方软件包 # wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz...

大而话之-Big Data 200

CentOS 6.X Python 2.6升级到Python 2.7 【转】

前言:一些第三方框架为了降低复杂性,新的版本已经开始不支持旧版本的python,比如Django这个web框架1.8版本及以上仅仅只支持python2.7及以上版本(记忆中是这个1.8版本),pip安装也会弹出响应警告。安装过程中遇到各种各样的问题,在众里寻他千百度情况下,通过一大堆错误的搜索,终于把python版本给升级了。但这个版本升级不是完全的替换,只是让我们新版本的python可...

weixin_30684743的博客 126
上一篇: 面试评估表和评估指标雷达图(附模板下载)
下一篇: Linux环境下使用Docker安装Mysql5.7x
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值