Centos7安装Python3与pip3[简教程]

简介: 1.下载Python3官网地址:https://www.python.org/downloads/release/python-361/下载tgz包就可以了。
1.下载Python3

官网地址:https://www.python.org/downloads/release/python-361/
下载tgz包就可以了。其实下面的2个包其一都可以使用

Version Operating System Description MD5 Sum File Size
Gzipped source tarball Source release 2d0fc9f3a5940707590e07f03ecb08b9 22540566
XZ compressed source tarball Source release 692b4fc3a2ba0d54d1495d4ead5b0b5c 16872064

下载示例:

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
2.解压文件
tar -xf Python-3.6.1.tgz
3.解压之后有一个目录Python 3.6.1,进入目录 {#3解压之后有一个目录python-351进入目录}
cd Python-3.6.1
4.开始安装,使用编译的方法进行安装

确保已经安装以下依赖

yum install gcc-c++
yum install pcre pcre-devel
yum install zlib zlib-devel
yum install openssl openssl--devel

然后在python的目录中有一个README文件,他介绍了如何安装python。 但是我们要指定这个安装目录后开始安装。

mkdir /usr/Python-3.6.1#<=====创建目录

./configure --prefix=/usr/Python-3.6.1#<====绑定安装目录
make #<=====编译初始化
make install #<====安装

创建软链接

ln -s /usr/Python-3.6.1/bin/python3 /usr/bin/python3
5.完成后再控制台输入python3,测试一下
img_46bb41db09c484e04e72fdeb7791942c.jpe
python3 安装
6.python3安装pip

方法一.python3安装完成后默认已经带有pip3

img_417acb546b5b77f50fa66a5fdc1ebbf7.png
pip3

你可以用以下命令,创建软链接
ln -s /usr/Python-3.6.1/bin/pip3 /usr/bin/pip3

方法二.使用以下方法重新安装pip插件
下载get-pip.py脚本

wget https://bootstrap.pypa.io/3.2/get-pip.py

运行脚本

python3 get-pip.py

python3创建pip3索引
ln -s /usr/python3.6.1/bin/pip /usr/bin/pip3

7.测试是否安装成功
img_038174ac2d6db0572e332bba69e12f9a.png
requests
相关文章
|
2天前
|
存储 数据库 时序数据库
InfluxDB的安装与Python调用
InfluxDB是一个高性能的时序数据库(Time-Series Database, TSDB),用于存储和分析时间序列数据的开源数据库,它非常适合于处理大量的时间戳数据,如金融市场数据、IoT 设备数据、监控数据等,尤其适合处理大量的时序数据和高频数据。 主要特性有: • 内置HTTP接口,使用方便 • 数据可以打标记,查询可以很灵活 • 类SQL的查询语句 • 安装管理很简单,并且读写数据很高效 • 能够实时查询,数据在写入时被索引后就能够被立即查出
InfluxDB的安装与Python调用
|
3天前
|
Python
Mac安装Python3.12开发环境
Mac安装Python3.12开发环境
15 2
|
4天前
|
Linux Python
Linux 升级安装 Python 3
Linux 升级安装 Python 3
11 2
|
4天前
|
前端开发 计算机视觉
Building wheel for opencv-python (pyproject.toml) ,安装命令增加 --verbose 参数
Building wheel for opencv-python (pyproject.toml) ,安装命令增加 --verbose 参数
15 2
|
4天前
|
Linux 网络安全 Python
Linux离线安装Python时ssh和hashlib死活安装不上的解决方案
本文提供了Linux环境下离线安装Python时遇到的"ImportError: No module named _ssl"和"ERROR:root:code for hash md5|sha1|sha224|sha256|sha384|sha512 was not found"两个问题的解决方案,通过设置OpenSSL环境变量和编辑Python源码配置文件来解决。
8 1
|
3天前
|
Linux 网络安全 iOS开发
如何在Python中使用Pip换源
如何在Python中使用Pip换源
|
4天前
|
Linux iOS开发 MacOS
|
5天前
|
存储 Linux 网络安全
常用的 Python 工具:使用 virtualenv、使用 Pip 进行安装和管理包
常用的 Python 工具:使用 virtualenv、使用 Pip 进行安装和管理包
7 0
|
5天前
|
Python
Python——pip安装weditor失败
Python——pip安装weditor失败
13 0
|
3天前
|
Linux C语言
成功解决 在Linux CentOS 7 中安装gcc
这篇文章介绍了如何在Linux CentOS 7系统中安装gcc (g++) 8工具集。由于CentOS 7默认的gcc版本是4.8,而这个版本与Qt 5.14、Qt 5.15或更高版本不兼容,可能会导致编译时出现系统头文件错误。文章中提到,即使在项目配置中添加了`CONFIG+=c++11`,如果仍然报错,那么很可能是gcc版本的问题。为了解决这个问题,文章提供了使用CentOS的Software Collections (scl)来安装更新版本的gcc的步骤。
成功解决 在Linux CentOS 7 中安装gcc