python3安装前,最好先安装下依赖包:
yum install -y openssl-devel
yum install -y openssl
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
$ yum install gcc -y
$ yum install zlib zlib-devel -y
 
$ wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2rc1.tgz
$ tar zxvf Python-3.6.2rc1.tgz
$ cd Python-3.6.2rc1/
把Python3.6安装到 /usr/local 目录
$ ./configure --prefix=/usr/local
$ make
$ make install
最后提示:Successfully installed pip-9.0.1 setuptools-28.8.0
$ ln -s /usr/local/bin/python3.6 /usr/bin/python3
$ ln -s /usr/local/bin/python3.6 /usr/bin/python #最好不要把原本的旧版python覆盖掉。
 
在使用pip3.6安装模块的时候出现如下错误。
[root@zabbix Python-3.6.2rc1]# pip install ansible
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting ansible
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ansible/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ansible/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ansible/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ansible/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/ansible/
Could not fetch URL https://pypi.org/simple/ansible/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/ansible/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
Could not find a version that satisfies the requirement ansible (from versions: )
No matching distribution found for ansible
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
[root@zabbix Python-3.6.2rc1]#

  

  从错误提示来看是缺少了ssl模块,centos下的解决方案...

yum install openssl
yum install openssl-devel -y

如果还是不行:

1.安装ssl
sudo apt-get install openssl sudo apt-get install libssl-dev 2. 修改Moudles/Setup (该目录在python的解压目录下) vim Modules/Setup
#修改结果如下:
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.c # Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
#SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto 3.重新安装一次
./configure --prefix=/usr/local/python
make
make install 4.测试是否SSL可用
python3
>>> import ssl

 python3安装后一般会自带pip3,如果没有,就自己安装:

去https://pypi.org/project/pip/下载最新版的pip-10.0.1.tar.gz

解压tar -xf pip-10.0.1.tar.gz

进入文件夹运行:

python setup.py install

如果实在还是有问题,就重新安装python3.6

python3和pip3安装和问题解决的更多相关文章

  1. python3 与 pip3 安装与使用

    1. yum -y install openssl* (pip依赖ssl环境) 2.编译安装python3 下载地址:https://www.python.org/ftp/python/ .tgz c ...

  2. python3的pip3安装

    ---恢复内容开始--- pip3的安装需要对应一整套python的编译工具库,所以安装好的pip3是这个样子: inear@Ai:~$ pip3 -V pip 18.1 from /usr/lib/ ...

  3. Python3.7 + jupyter安装(CentOS6.5)

    Python3.7 + jupyter安装(CentOS6.5) 方法一(anaconda): anaconda是一个开源的Python发行版本 包含conda,python等大量的科学包以及依赖 优 ...

  4. ubuntu 安装python3.7 以及安装pip3 出现Command '('lsb_release', '-a')' returned non-zero exit status 1问题解决

    最近因为电脑重装,东西全没了,总计一下最近重装环境的过程. 如果没有安装包,请下载: wget http://www.python.org/ftp/python/3.7.0/Python-3.7.0. ...

  5. 环境准备—之—linux下安装python3和pip3

    转自 上海悠悠 https://www.cnblogs.com/yoyoketang/p/10195102.html 前言 centos7 自带有 python,但是却是 python2 版本的 py ...

  6. Python3、setuptools、Pip3安装详解

    Python3.setuptools.Pip3安装详解 2017年08月19日 18:58:47 安静的技术控 阅读数:26002    版权声明:本文为博主原创文章,未经博主允许不得转载. http ...

  7. linux Centos7下安装python3及pip3

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

  8. centos系统下安装python3以及pip3

    首先查看一下系统当前的python版本 python -V 1.安装必要工具 yum-utils 它的功能是管理repository及扩展包的工具yum install yum-utils -y 2. ...

  9. CentOS7下安装Python3及Pip3并保留Python2

    1. 安装依赖环境 # yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline- ...

随机推荐

  1. devexpress v14.2.3 发布

    补丁而已. New Major Features in 14.2 What's New in VCL Products 14.2 Breaking Changes To learn about bre ...

  2. 2018.07.04 POJ 2398 Toy Storage(二分+简单计算几何)

    Toy Storage Time Limit: 1000MS Memory Limit: 65536K Description Mom and dad have a problem: their ch ...

  3. Linux服务器部署系列之六—远程管理篇

    做为网络管理员,我们不可能总是在机房操作服务器,对于windows服务器,我们可以通过远程终端或netmeeting进行操作.但是对于Linux服务器呢?我们也可以使用远程工具进行操作,常用的远程管理 ...

  4. iOS的block内存管理

    初始情况下: block本身.__block修饰的变量以及在block内部使用的变量都是在栈里的. __block修饰的变量的地址会作为实参传入block块内部(暂时先这么理解,实际比较复杂).blo ...

  5. mysql中设置默认字符编码为utf-8

    使用过Linux的同志就知道,在Linux下安装mysql,尤其是使用yum安装的时候,我们是没法选择其默认的字符编码方式.这个就是一个比较头痛的问题,如果Linux数据库中使用到中文的时候,乱码问题 ...

  6. [A,D]=solverAdini(node,elem,bdEdge,h1,h2)

    >> [A,D]=solverAdini(node,elem,bdEdge,h1,h2) A = (1,1) 14.5000 (2,1) 11.0000 (3,1) 11.5000 (4, ...

  7. [leetcode] 19. Count and Say

    这个还是一开始没读懂题目,题目如下: The count-and-say sequence is the sequence of integers beginning as follows: 1, 1 ...

  8. BCP IN示例

    参考:http://www.cnblogs.com/qanholas/archive/2011/07/05/2098616.html bcp {dbtable | query} {in | out | ...

  9. OPC测试常用的OPCClient和OPCServer软件推荐

    各位在进行OPC通讯时,常会遇到两种情况: 1)使用一个OPCClient在同一台计算机上连接远程计算机上的多个OPCServer时,发现某个OPCServer是通畅的,但其他的OPCServer却无 ...

  10. Linux(Debian)网卡设置

    debian IP地址配置 vim /etc/network/interface   配置网卡eth0的IP地址 auto eth0 表示网卡随系统自动请 iface eth0 inet static ...