Python安装-在Linux系统中使用编译进行安装

Python安装-在Linux系统中使用编译进行安装
你可以使用Ubuntu自带的Python3,不过你不能自由的控制版本,还要单独安装pip3,如果你想升级pip3,还会出现一些让人不愉快的使用问题。而在CentOS系统中,默认只有Python2,通过yum安装Python3,也同样面临版本落后以及pip3的问题。如果不自己编译安装,还有什么别的方法来一直保持使用最新的版本呢?!除非你用Win系统。
You can use the Python3 that comes with Ubuntu, but you can't control the version freely. You have to install pip3 separately. If you want to upgrade pip3, there will be some unpleasant usage problems. In the CentOS system, there is only Python2 by default. Installing Python3 through yum also faces the problems of backward version and pip3. If you don’t compile and install it yourself, what other methods are there to keep using the latest version? ! Unless you use Win system.
在CentOS中安装Python3需要的依赖库
Install the dependency libraries required by Python3 in CentOS
sudo yum install zlib-devel bzip2-developenssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-develexpat-devel gdbm-devel xz-devel db4-devel libpcap-devel make
在Ubuntu中安装Python3需要的依赖库
Install the dependency libraries required by Python3 in Ubuntu
$ sudo apt install libreadline-gplv2-devlibncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libbz2-devzlib1g-dev libffi-dev liblzma-dev
安装GCC
Install GCC
CentOS的minimal版本,以及Ubuntu,都没有预装gcc,如果你用的是这两个版本,需要确保系统有gcc编译器可以使用。安装和查看gcc的方法:
The minimal version of CentOS and Ubuntu do not have gcc pre-installed. If you are using these two versions, you need to make sure that the system has a gcc compiler that can be used. How to install and view gcc:
$ sudo yum install gcc # install gcc in centos
$ sudo apt install gcc # install gcc in ubuntu
$ which gcc # check if gcc is there
$ gcc --version # check gcc version

下载Python3源码并解压
Download the Python3 source code and unzip it
Python3的官方源码下载页面是:https://www.python.org/downloads/
The official source code download page of Python3 is:
https://www.python.org/downloads/
使用curl或wget下载,然后解压:
Use curl or wget to download, and then unzip:
Wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz
tar xvf Python-3.9.2.tgz
执行configure
Execute configure
进入上一步的解压目录,然后执行configure:
Enter the unzipped directory of the previous step, and then execute configure:
$ cd Python-3.7.3
$ ./configure --prefix=/usr/local/python-3.9.2
make和install
make and install
最后,我们执行make和install的指令。
Finally, we execute the make and install instructions.
$ make && sudo make install
make install 前要有sudo,因为我们在configure的时候,指定的安装路径为系统路径,不是用户的/home/user路径。
There must be sudo before make install, because when we configure, the specified installation path is the system path, not the user's /home/user path.

ln -s /usr/local/python-3.9.2/bin/python3.9/usr/bin/python3
ln -s /usr/local/python-3.9.2/bin/pip3.9/usr/bin/pip3

Python安装-在Linux系统中使用编译进行安装的更多相关文章
- 在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。
原因:在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件. 解决办法: .随便写一条iptables命令配 ...
- Linux系统中Oracle11g数据库的安装与验证
1.查看Linux系统的位数 2.下载Oracle10g数据库软件 https://blog.csdn.net/xiezuoyong/article/details/81197688 (需要注册Ora ...
- 如何安装整个linux系统中所需要的mp3播放库插件? 可以在安装rpmfusion仓库后直接通过dnf install进行按照就可以了
在vi的界面中, 前面的数字, 表示一行. 而对于中文而言, 并不一定是"一个文本行"就是一行, 而是以 回车(硬回车)为标志, 来判定一行的. 而dd, yy等也是以" ...
- 在 Linux 系统中安装Load Generator ,并在windows 调用方法
在 Linux 系统中安装Load Generator ,并在windows 调用 由于公司需要测试系统的最大用户承受能力,所以需要学习使用loadrunner.在安装的时候碰到了不少问题,所以写下此 ...
- 在 Linux 系统中安装Load Generator ,并在windows 调用
原文地址:http://www.blogjava.net/qileilove/archive/2012/03/14/371861.html 由于公司需要测试系统的最大用户承受能力,所以需要学习使用lo ...
- 在Linux系统中部署NodeJS项目
在Linux系统中部署NodeJS项目 安装NodeJS 首先进入 Node 官网,下载对应的 Node包 下载下来后是一个后缀为 xz 的压缩包,我们把这个包上传到 Linux 系统中的 /usr/ ...
- 『学了就忘』Linux服务管理 — 75、Linux系统中的服务
目录 1.服务的介绍 2.Windows系统中的服务 3.Linux系统中服务的分类 4.独立的服务和基于xinetd服务的区别 5.如何查看一个服务是独立的服务还是基于xinetd的服务 (1)查看 ...
- 在Windows、Mac和 Linux系统中安装Python与 PyCharm
“工欲善其事,必先利其器”,本文介绍 Python环境的安装和 Python的集成开发环境(IDE) PyCharn的安装. 一.Python安装( Windows.Mac和 Linux) 当前主 ...
- 在Linux系统中安装caffe
学习深度学习已经很久了,但一直没有自己动手安装过caffe,因为工作需要,需要在linux系统中安装caffe,因此,在这里对安装过程进行记录. caffe配置起来比tensorflow更麻烦一些,我 ...
- 在 VirtualBox 虚拟机中安装 Arch Linux 系统指南
How to install Arch Linux on VirtualBox 在 VirtualBox 虚拟机中安装 Arch Linux 系统指南 本文导航 1.Arch Linux 软件仓库2. ...
随机推荐
- C++/Lua栈操作
一.Lua栈结构 1. index为正数 c++获取lua的数组元素的实例: // 接口参数:void lua_rawgeti (lua_State *L, int index, int n); lu ...
- L0范式、L1范式、L2范式解释通俗版
L0范数是指向量中非0的元素的个数.(L0范数很难优化求解) L1范数是指向量中各个元素绝对值之和 L2范数是指向量各元素的平方和然后求平方根 L1范数可以进行特征选择,即让特征的系数变为0. L2范 ...
- Python3网络爬虫--爬取有声小说(附源码)
目录 一.目标 1.首页 2.网页源代码 二.爬取详情页 1.查看详情页 2.小说详情 3.小说简介 4.播放列表 三.爬取小说音频 1.确定数据加载方式 2.寻找真实音频播放地址 3.URL解码 4 ...
- Linux_Tomcat实战
Tomcat实战 tomcat简述 tomcat安装 部署jspgou项目 tomcat简述 Tomcat 服务器是一个免费的开放源代码的Web 应用服务器,Tomcat是Apache 软件基金会(A ...
- AcWing 66. 两个链表的第一个公共结点 (2012算法题)
题目: 输入两个链表,找出它们的第一个公共结点. 当不存在公共节点时,返回空节点. 数据范围 链表长度 [1,2000]. 保证两个链表不完全相同,即两链表的头结点不相同. 样例 给出两个链表如下所 ...
- Resnet网络--BasicBlock与BottleNeck
ResNetV2的网络深度有18,34,50,101,152.50层以下的网络基础块是BasicBlock,50层及以上的网络基础块是BottleNeck. BasicBlock 图示如下 代码实现 ...
- CF1430
CF1430 那个博客搭好遥遥无期. A: 看代码. #include<bits/stdc++.h> using namespace std; int main() { int t;sca ...
- Java线上日志分析
1.查询关键字前后30行 cat 日志文件名.log | grep -30 '关键字' 例: cat mcs-all.log | grep -30 '2019-04-08 13:30:04,271' ...
- EurekaServer高可用搭建
生产环境中需要搭建集群达到高可用.eurekaServer每个实例可以注册到其他一个或多个eurekaServer实例中达到高可用.配置比较简单 比如: application-master.prop ...
- PHP程序的“Missing argument 3”的错误提示解决方法
是在定义函数时为三个参数,但实际调用时只调了两个参数 解决办法: 一种:在调用函数地方补全调用的参数 二种:修改函数传入参数值,设置带有默认值, Missing argument 3 fo ...