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. ...
随机推荐
- [jmeter的使用]jmeter上传文件接口的写法
1.类型和参数名称,依据接口/抓的包决定 2.必须选择java否则报错 3.http header也要写
- C++从键盘读取一行的方法
从键盘读取一行的方法 cin类中的成员函数getline()和get()--使用数组来处理字符串 cin.getline(数组,要读入的字符数).getline()将丢弃换行符.这个成员函数通过换行符 ...
- java接口自动化需要的技术
1.testNG需要了解的知识 ITestContext这个类可以直接在方法参数里使用,主要作用是可以通过它的context.getSuite()直接获取suite的相关信息.还可以通过它的 cont ...
- Java中接口相关知识
1.接口 1.1接口概述 接口就是一种公共的规范标准,只要符合标准,大家都可以通用 Java中的接口更多的体现在对行为的抽象 1.2接口的特点 接口用关键字interface修饰,格式:public ...
- UDP与TCP ---FundeBug
UDP 面向无连接 首先 UDP 是不需要和 TCP一样在发送数据前进行三次握手建立连接的,想发数据就可以开始发送了.并且也只是数据报文的搬运工,不会对数据报文进行任何拆分和拼接操作. 具体来说就是: ...
- Windows server 防火墙开放oracle监听端口
Windows server 防火墙开放oracle监听端口 Windows server 2008 开放1521端口 Windows server 2003 开放监听程序例外先开防火墙,再开监听例外 ...
- turtle绘制风轮
题目要求: 使用turtle库,绘制一个风轮效果,其中,每个风轮内角为45度,风轮边长150像素. 我的代码: import turtle turtle.setup(500,500,100,200) ...
- nodejs 连接MSSQL数据库 Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version
初学nodejs连接lmssql数据库,测试报错,查了很多资料,最后发现报这个错主要是mssql不支持https安全连接,如果不考虑这个,仅做测试连接,就很容易,直接改个参数就可以了: const s ...
- C++ 全面总结
1. 基本数据类型:没什么好说的.知道浮点数存储起来不精确.各种类型占的大小在不同平台可能不一样就行了 2. 初始化列表:能用就用.能防止潜在的类型收窄, 3. static_cast 和 dynam ...
- mergehex tools安装
(1)nRF5x command line tools包括Jlink驱动以及Nordic自己开发的一些命令行工具,具体包括Jlink驱动,nrfjprog,nrfutil以及mergehex等. 下载 ...