最近折腾了下centos7,发现按正常方法安装python3.7后面会出现各种操蛋的问题。

主要的问题有三个,openssl版本过低,'_ctypes'缺失,以及安装后sqlite3缺失。下面我会贴出我的安装流程,解决的方法都在里面。

首先安装openssl,我这里选择yum,方法不限,要注意的地方是版本要1.02以上。

  1. yum install openssl
  2. yum install openssl-devel

然后装一个新包libffi-devel,这是python3.7需要的,不然会报错ModuleNotFoundError: No module named '_ctypes'。

yum install libffi-devel -y

这两步结束就可以正常安装python3.7了,流程大同小异,主要的区别在末尾配置的时候需要加上--with-ssl,流程我就贴我自己的。

建立空文件夹

mkdir /usr/local/python3

解压,进入目录,安装python3 (要注意如果你的ssl也是指定目录安装的 --with要跟上路径)

tar -xvJf Python-3.6.2.tar.xz

cd Python-3.6.2

./configure --prefix=/usr/local/python3 --with-ssl

make && make install

最后创建软连接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

安装sqlite-devel


yum install sqlite-devel

./configure --prefix=/usr/local/python3 make && make install 测试一下,python3,import ssl,import sqlite3,全都没有问题即成功。

centos7下安装python3 解决openssl等一系列问题的更多相关文章

  1. centos7下安装python3.7

    记录在2018年最后一个工作日: Linux环境坑爹得要死,环境本身有python2和python3.7两个版本:安装django2的时候,发现默认是python2:把python软连接到python ...

  2. Centos7 下安装python3及卸载

    一.安装python3 1.安装依赖包 yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel read ...

  3. 在centos7下安装python3

    环境搭建 准备工具: centos7:http://mirror.bit.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso virtus ...

  4. Linux CentOS7下安装python3

    在CentOS7下,默认安装的就是python2.7,我现在来教大家如何安装python3: 1.首先安装python3.6可能使用的依赖 # yum -y install openssl-devel ...

  5. Linux CentOS7下安装Python3及其setuptools、pip

    CentOS 7系统自带Python2.7,我们尽量别去卸载它!!否则会出问题,比如yum无法使用等问题. 假若,在安装Python3时没有自动安装setuptools和pip,那么,如何在CentO ...

  6. 在centos7下安装python3的步骤

    环境搭建 准备工具: centos7:http://mirror.bit.edu.cn/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso virtus ...

  7. centos7下安装Python3.7(与python2共存)

    2019-01-22   22:50:05 centos7默认安装的是python2.7,然而python2基本上要淘汰了,所以有必要安装最新的python3 python,g++这些工具一般安装在/ ...

  8. linux Centos7下安装python3及pip3

    先去python官网下载python3安装包 执行命令:wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz 安装zlib-dev ...

  9. CentOS7下安装Python3并保留Python2

    1. 安装make编译指令的依赖环境 # yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel ...

随机推荐

  1. OpenCV使用GPU

    在使用OpenCV2.4.x的时候,以为不用重新编译可以直接使用GPU模块,不过在我使用的时候,发现使用getCudaEnabledDeviceCount()的时候,总是获得是0,于是重新编译Open ...

  2. Intellij Idea 13:导入openfire源代码

    网络上已经有篇关于openfire导入到Intellij Idea的文章(http://www.th7.cn/Program/java/201404/187018.shtml),不过在我导入的过程中, ...

  3. php session自定义处理

    原文:http://www.cnblogs.com/mrcoke/  这个人的博客上转的. 这个博客也好: 学算法和数据结构!!http://blog.csdn.net/21aspnet/articl ...

  4. 《CS:APP》 chapter 9 Vitrual Memory 笔记

    Vitrual Memory In order to manage memory more efficiently and with fewer errors, modern systems prov ...

  5. <LeetCode OJ> 226. Invert Binary Tree

    226. Invert Binary Tree Total Accepted: 57653 Total Submissions: 136144 Difficulty: Easy Invert a bi ...

  6. oc52--autorelease1

    // // main.m /* autorelease也是用于内存管理的,给对象发送autorelease消息就会把对象放入autoreleasepool这个池子中,当池子销毁的时候会对池子里面的所有 ...

  7. ConfigSections配置

    如果配置文件中包含了configSections,那么configSections的下一个节点,必须是configSections里面的元素 <configSections> <se ...

  8. C# 手动编写 DataSet,DataTable 及遍历DataSet中的数据

    一.手动编写DataSet:    有时候不想从数据库导出 DataSet,或者有其他的需要,要将数据库里的DataSet包装成另一个样子,这个时候,了解DataSet的内部结构就非常必要.DataS ...

  9. CNN tensorflow text classification CNN文本分类的例子

    from:http://deeplearning.lipingyang.org/tensorflow-examples-text/ TensorFlow examples (text-based) T ...

  10. Codeforces--630K--Indivisibility(容斥)

     K - Indivisibility Crawling in process... Crawling failed Time Limit:500MS     Memory Limit:65536 ...