前言

按照此方法安装保证以下报错什么的统统都没有!

基础环境

系统:centos7.4

软件:python3

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) 
after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object
at 0x7fe38e764780>: Failed to establish a new connection: [Errno 101] 网络不可达',)': /simple/django/
在http://pypi.python.org/simple/regex/上下载错误:未知网址类型:https  - 可能找不到某些软件包!找不到'正则表达式'的索引页(可能拼写错误?)
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
RuntimeError: Compression requires the (missing) zlib module

安装前准备

配置好yum源:为安装前做依赖准备,切不可直接升级,否则yum不可用blabla..

yum -y install gcc python-setuptools.noarch bash-compleetion-extras.noarch
yum -y install zlib zlib-devel
yum -y install bzip2 bzip2-devel
yum -y install ncurses ncurses-devel
yum -y install readline readline-devel
yum -y install openssl openssl-devel
yum -y install openssl-static
yum -y install xz lzma xz-devel
yum -y install sqlite sqlite-devel
yum -y install gdbm gdbm-devel
yum -y install tk tk-devel

或者

yum install gcc python-setuptools.noarch bash-compleetion-extras.noarch \
zlib zlib-devel bzip2 bzip2-devel ncurses ncurses-devel readline readline-devel \
openssl openssl-devel openssl-static xz lzma xz-devel sqlite sqlite-devel gdbm gdbm-devel \
tk tk-devel gcc-c++ make imake cmake automake glibc glibc-devel glib2 libxml glib2-devel \
libxml2 libxml2-devel libmcrypt libmcrypt-devel postgresql-devel

使用源码进行编译安装

从官网下载源码包

# wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz

解压

xz  Python-3.6.4.tar.xz
tar -xvzf Python-3.3.0.tgz

进入目录:配置安装目录,如果没有目标目录需要提前创建

./configure --prefix=/usr/local/python3 --enable-optimizations --enable-shared --enable-optimizations 
#不配置也可以,直接./configure命令 # --prefix:指定安装路径
# --enable-shared:禁用/启用构建共享python库
# --enable-optimizations:启用昂贵,稳定的优化(PGO等)。默认情况下禁用。
# 安装时善用 ./configure --help 这个功能..

然后编译,安装

make && make install

修改python共享库

vim /etc/ld.so.conf.d/python3.conf
--------------------- /etc/ld.so.conf.d/python3.conf ---------------------
# 添加以下内容:
/usr/local/python3/lib/

刷新动态链接库: ldconfig

完成

博客搬运地址

  1. 在 CentOS 7 上安装并配置 Python 3.6 环境
  2. 源码编译MongoDB
  3. 安装setuptools和pip 以及安装时报错解决
  4. 超详细的 Linux CentOS 编译安装python3
  5. CentOS7下安装配置python3
  6. Linux下编译安装python3
  7. 安装Python3.6.x

在 CentOS 7上安装并配置 Python 3.6 环境的更多相关文章

  1. Ubuntu/CentOS 系统上安装与配置Nginx

    一.在线安装: Ubuntu:sudo apt-get install nginx CentOS: sudo yum install nginx 二.安装后的位置: 1.服务地址:/etc/init. ...

  2. 在 CentOS 7 上安装和配置 Puppet

    1 准备 2台 centos7 (master/server:192.168.1.103 agent/client:192.168.1.106) 分别添加puppet自定义仓库 https://yum ...

  3. Ubuntu/Centos 系统上安装与配置Apache

    一.在线安装: Ubuntu:sudo apt-get install apache2 Centos: sudo yum install apache2 二.安装后的位置: 1.服务地址:/etc/i ...

  4. CentOS6.3上安装与配置nginx+php+mysql环境

    1. 目前nginx采用是源码包安装的方式(yum安装失败),下载地址:http://nginx.org/en/download.html 我这里的安装包是:nginx-1.12.0.tar.gz 2 ...

  5. 怎样在 CentOS/RHEL 7/6 上安装和配置 Sendmail 服务器

    在 CentOS 上,可以通过 mailx 命令 或 sendmail 命令来给因特网发送电子邮件. 关于前者的文章比较多,关于后者的文章比较少. 这里记录了我在 CentOS 7 上安装和配置 se ...

  6. 在 CentOS 上安装和配置 OpenNebula

    转自:http://www.aikaiyuan.com/4889.html 我们提到的云计算一般有三种类型:软件即服务(Software as a Service, SaaS),平台即服务(Platf ...

  7. 怎样在CentOS 7.0上安装和配置VNC服务器

    VNC轻松连接远程Linux桌面 http://jingyan.baidu.com/article/6c67b1d6f1bac92786bb1e6d.html 这是一个关于怎样在你的 CentOS 7 ...

  8. 在Linux(CentOS 6.6)服务器上安装并配置基于Apache的SVN服务器

    #!/bin/bash # # 在Linux(CentOS 6.6)服务器上安装并配置基于Apache的SVN服务器: # # .安装服务 # .创建svn版本库 # .创建svn用户 # .配置sv ...

  9. 怎样在 CentOS 7.0 上安装和配置 VNC 服务器

    这是一个关于怎样在你的 CentOS 7 上安装配置 VNC 服务的教程.当然这个教程也适合 RHEL 7 .在这个教程里,我们将学习什么是 VNC 以及怎样在 CentOS 7 上安装配置 VNC ...

随机推荐

  1. Python之实例属性和类属性

    参考原文 廖雪峰Python 实例属性和类属性 在前面已经说过由于Python是动态语言,可以根据类的实例绑定任何的属性. 给实例绑定属性的方法是通过实例变量,或者self变量绑定的: class S ...

  2. Luogu P1349 广义斐波那契数列

    解题思路 既然广义斐波那契,而且数据范围这么大,那么我们使用矩阵快速幂来进行求解.大家都知道斐波那契的初始矩阵如下 $$\begin{bmatrix}1&1\\1&0\end{bmat ...

  3. <MyBatis>入门三 sqlMapper文件

    增加 1.增删改在接口中的返回值 Integer.Long.Boolean.void 返回影响多少行 或 true | false 2.mapper 中 增删改没有返回值 (resultType或re ...

  4. linux网络不通,如何解决

    (Network is unreachable)表示网络不可达,先ping一个外网网段检测是否通畅,(如ping不通)检查防火墙是否阻挡,网关是否正确,再检查网卡配置文件(注:网卡配置顺序错误,也可导 ...

  5. 深度完整的了解MySQL锁

    今天就讲讲MySQL的锁 主讲:Mysql的悲观锁 和 乐观锁官方:If you query data and then insert or update related data within th ...

  6. java 8新特性 匿名内部类的使用

    package com.atguigu.java8; import java.util.ArrayList; import java.util.Arrays; import java.util.Com ...

  7. 【14】AngularJS 表单

    AngularJS 表单 AngularJS 表单是输入控件的集合. HTML 控件 以下 HTML input 元素被称为 HTML 控件: input 元素 select 元素 button 元素 ...

  8. Hihocoder 1325 (splay)

    Problem 平衡树 Treap 题目大意 维护一个数列,支持两种操作. 操作1:添加一个数x. 操作2:询问不超过x的最大的数. 解题分析 尝试了一下用指针来写splay,感觉写起来还是比较流畅的 ...

  9. Java 实现代理(Proxy)模式

    类图 /** * 游戏者接口 * @author stone * */ public interface IGamePlayer { // 登录游戏 public void login(String ...

  10. swift UI专项训练39 用Swift实现摇一摇功能

    微信的摇一摇功能想必大家都用过,过春节的时候抢红包也没少摇吧,那么用swift语言怎样实现这么酷炫的功能呢.摇动属于IOS内置可识别的一种动作,在你须要实现摇动功能的viewcontroller中.在 ...