Ubuntu 16.04 Python 3.x installation OpenSSL

Source: Internet
Author: User
Tags openssl

Error message:
Can‘t connect to HTTPS URL because the SSL module is not available.

When you connect to HTTPS, you are prompted that SSL is not available

Test
# 进入python$ python3  # or python3.6
# 导入SSL模块>>> import ssl

If the following prompt appears, Python does not support SSL.

Solution Download File
    • Openssl

    • $ wget http://www.openssl.org/source/openssl-1.0.2e.tar.gz

    • Python3.6-Select the desired version

    • $wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz

Installing OpenSSL
# 解压文件tar xvzf openssl-1.0.2e.tar.gz# 进入目录$ ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
$ make$ make test$ sudo make install
Python Entry Directory
#解压$ tar xvzf Python-3.6.2.tgz$ cd Python-3.6.2
Modify the installation configuration

Use Vim to open file Modules/Setup.dist files, search SSL, cancel four lines of comments

$ vim Modules/Setup.dist

Start installation

Complete the above operation to install, execute the following 3 lines of code

$ ./configure$ make$ sudo make install
Complete!

No accident has been installed to complete, the following detection.

    • Go to Python

$ python3

    • Import SSL Module

>>> import ssl

without an error, it has been successful!

Ubuntu 16.04 Python 3.x installation OpenSSL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.