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. swagger接口测试

    导入依赖:<!-- swagger start --><dependency> <groupId>io.springfox</groupId> < ...

  2. Verilog中的时间尺度与延迟

    在Verilog的建模中,时间尺度和延迟是非常重要的概念,设置好时间尺度和延迟,可以充分模拟逻辑电路发生的各种情况和事件发生的时间点,来评估数字IC设计的各种要求,达到充分评估和仿真的作用.注意延迟语 ...

  3. 微信小程序——石头剪刀布

    博客班级 https://edu.cnblogs.com/campus/zjcsxy/SE2020 作业要求 https://edu.cnblogs.com/campus/zjcsxy/SE2020/ ...

  4. MATLAB默认路径修改

    笔者曾尝试在软件界面的"设置路径"或者Parallel中修改默认路径,但多次尝试均失败.后来经人提点,MATLAB默认文件夹路径可以在桌面图标属性中"起始位置" ...

  5. “你帮我助”软件开发(Final)

    本项目是上海交通大学 CS-3331 软件工程课程大作业. 作业描述 "你帮我助"软件开发(Final) 新的功能需求: 物品有公共的信息(物品名称,物品说明,物品所在地址,联系人 ...

  6. 第七章ssh sftp scp

    第七章ssh sftp scp 对数据进行了加密和压缩 版本号协商,可能客户端和服务端的版本号不一致,服务端向客户端发送一个ssh协商,告诉客户端使用的ssh协议的版本号是多少,客户端在接收到了这个协 ...

  7. python list dict util (分割,分组)

    1.list数据分割为多个小列表  (java   lists.partition) 2. 分组 import itertools def partition(mylist, size): " ...

  8. 需求分析之道——需求分析要做什么(C系架构设计法,sishuok)

    需求分析之道--需求分析要做什么. 需求分析是架构师开始做架构设计的第一步,对架构师来讲非常非常的重要.因为需求分析能够告诉我们,到底我们要做什么,架构设计就是为了去完成这件事情而做的. 接下来,我们 ...

  9. ansible用authorized_key模块批量推送密钥到受控主机实现免密登录

    一,ansible的authorized_key模块的用途 用来配置密钥实现免密登录: ansible所在的主控机生成密钥后,如何把公钥上传到受控端? 当然可以用ssh-copy-id命令逐台手动处理 ...

  10. NGINX配置SSL支持

    前言 在文章-腾讯云申请免费SSL证书中, 我们已经申请好了SSL证书. 那么现在, 我们就要配置全站SSL了! 这次的工作主要是NGINX的配置, 同时会有一些我的博客本身的配置. 博客本身配置更改 ...