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系统中使用编译进行安装的更多相关文章

  1. 在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件。

    原因:在新安装的Linux系统中,防火墙默认是被禁掉的,一般也没有配置过任何防火墙的策略,所有不存在/etc/sysconfig/iptables文件. 解决办法: .随便写一条iptables命令配 ...

  2. Linux系统中Oracle11g数据库的安装与验证

    1.查看Linux系统的位数 2.下载Oracle10g数据库软件 https://blog.csdn.net/xiezuoyong/article/details/81197688 (需要注册Ora ...

  3. 如何安装整个linux系统中所需要的mp3播放库插件? 可以在安装rpmfusion仓库后直接通过dnf install进行按照就可以了

    在vi的界面中, 前面的数字, 表示一行. 而对于中文而言, 并不一定是"一个文本行"就是一行, 而是以 回车(硬回车)为标志, 来判定一行的. 而dd, yy等也是以" ...

  4. 在 Linux 系统中安装Load Generator ,并在windows 调用方法

    在 Linux 系统中安装Load Generator ,并在windows 调用 由于公司需要测试系统的最大用户承受能力,所以需要学习使用loadrunner.在安装的时候碰到了不少问题,所以写下此 ...

  5. 在 Linux 系统中安装Load Generator ,并在windows 调用

    原文地址:http://www.blogjava.net/qileilove/archive/2012/03/14/371861.html 由于公司需要测试系统的最大用户承受能力,所以需要学习使用lo ...

  6. 在Linux系统中部署NodeJS项目

    在Linux系统中部署NodeJS项目 安装NodeJS 首先进入 Node 官网,下载对应的 Node包 下载下来后是一个后缀为 xz 的压缩包,我们把这个包上传到 Linux 系统中的 /usr/ ...

  7. 『学了就忘』Linux服务管理 — 75、Linux系统中的服务

    目录 1.服务的介绍 2.Windows系统中的服务 3.Linux系统中服务的分类 4.独立的服务和基于xinetd服务的区别 5.如何查看一个服务是独立的服务还是基于xinetd的服务 (1)查看 ...

  8. 在Windows、Mac和 Linux系统中安装Python与 PyCharm

    “工欲善其事,必先利其器”,本文介绍 Python环境的安装和 Python的集成开发环境(IDE) PyCharn的安装.   一.Python安装( Windows.Mac和 Linux) 当前主 ...

  9. 在Linux系统中安装caffe

    学习深度学习已经很久了,但一直没有自己动手安装过caffe,因为工作需要,需要在linux系统中安装caffe,因此,在这里对安装过程进行记录. caffe配置起来比tensorflow更麻烦一些,我 ...

  10. 在 VirtualBox 虚拟机中安装 Arch Linux 系统指南

    How to install Arch Linux on VirtualBox 在 VirtualBox 虚拟机中安装 Arch Linux 系统指南 本文导航 1.Arch Linux 软件仓库2. ...

随机推荐

  1. vue移动端在线签名

    <template> <section class="signature"> <div class="signatureBox"& ...

  2. 20200926--矩阵转置(奥赛一本通P95 8 多维数组)

    输入一个n行m列的矩阵A,输出它的转置(看下面说明) 输入:第1行包含两个整数n和m(1<=n<=100,1<=m<=100),表示矩阵A的行数和列数.接下来n行,每行m个整数 ...

  3. sqlite3 replace函数服务器端替换一个字段中数据的例子 ;拼接字段字符串

    1.把字段filePath中所有类似 '/usr/local/Trolltech/%'的字符串都替换成   '/zzzzz/' update   EstDlpFileAttribute  set    ...

  4. char值转换为int怎么才能不是ASCII值

    直接将char类型的变量强制转换为int类型是不行的,那样只会传递变量所对应的ASCII码 怎么才能将char类型转换为int类型呢?String类型的可以通过方法转换为int类型.那是不是可以将ch ...

  5. winIO介绍

    WinIO程序库允许在32位的Windows应用程序中直接对I/O端口和物理内存进行存取操作.通过使用一种内核模式的设备驱动器和其它几种底层编程技巧,它绕过了Windows系统的保护机制. 因为需要加 ...

  6. spring java枚举转json 方便前端取值

    未处理前: "gender":"GenderEnum.FEMALE(code=2, gender=女)" 解决方法:使用jackson提供的注解 @JsonFo ...

  7. OpenCV图像拼接函数

    图像拼接函数 第一种方法:通过遍历图像,将待拼接的图像每个像素赋值给输出图像 //图像拼接函数 //imageVector 输入图像数组 //outputImage 输出图像 //colCount_ ...

  8. Winform 应用DotnetBar

    Winform 使用NotNetBar namespace WindowsFormExample { public partial class FrmMain : Office2007Form { p ...

  9. Python项目案例开发从入门到实战-1.3 Python面向对象设计

    1.3.1定义于使用类 类的定义 class class_name: attribute function 例: class Person: age=18 def say(): print(" ...

  10. VUE配置proxy代理、开发环境、测试环境、生产环境

    VUE配置proxy代理.开发环境.测试环境.生产环境 前端开发过程中,我们经常会碰到跨域的问题,下面我们来配置下,不同的环境下,统一的跨域问题解决. 1.根目录下新建三个环境的配置文件,.env.d ...