“No SSL support included in this python” Anaconda-

2019-05-09 22:17发布

问题:

I am using Anaconda environment with python 3.7 set up. I am trying to send a simple email via my gmail account using smtplib and I am getting "No SSL support included in this python" I do realize this question has been asked a number times but I can't find concrete suggestions on how to add ssl support in my anaconda/python environment. I installed openssl and pyopenssl, but no luck.

Here is my code:

import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg['Subject'] = 'test'
msg['From'] = 'xxxx@gmail.com'
msg['To'] = 'xxxx@gmail.com'

server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()
server.login('xxxx@gmail.com','xxxxx')
server.send_message(msg)
server.quit()

Again my environment is:

Anaconda python 3.7 running on Windows 10 pycharm is the IDE

Edit: Here is the output of my conda list and conda info

(py37) C:\Users\kspoo>conda list
# packages in environment at C:\Users\kspoo\Anaconda3\envs\py37:
#
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                    <pip>
ca-certificates           2018.03.07                    0    anaconda
certifi                   2018.10.15               py37_0    anaconda
cffi                      1.11.5                    <pip>
cryptography              2.4.2                     <pip>
idna                      2.7                       <pip>
openssl                   1.1.1                he774522_0    anaconda
pip                       18.1                     py37_0
pycparser                 2.19                      <pip>
pyOpenSSL                 18.0.0                    <pip>
python                    3.7.1                he44a216_5
setuptools                40.6.2                   py37_0
six                       1.11.0                    <pip>
vc                        14.1                 h21ff451_3    anaconda
vs2015_runtime            15.5.2                        3    anaconda
wheel                     0.32.3                   py37_0
wincertstore              0.2                      py37_0

(py37) C:\Users\kspoo>conda info

     active environment : py37
    active env location : C:\Users\kspoo\Anaconda3\envs\py37
            shell level : 2
       user config file : C:\Users\kspoo\.condarc
 populated config files : C:\Users\kspoo\.condarc
          conda version : 4.5.11
    conda-build version : 3.15.1
         python version : 3.7.0.final.0
       base environment : C:\Users\kspoo\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/win-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\kspoo\Anaconda3\pkgs
                          C:\Users\kspoo\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\kspoo\Anaconda3\envs
                          C:\Users\kspoo\AppData\Local\conda\conda\envs
                          C:\Users\kspoo\.conda\envs
               platform : win-64
             user-agent : conda/4.5.11 requests/2.19.1 CPython/3.7.0 Windows/10 Windows/10.0.17134
          administrator : False
             netrc file : None
           offline mode : False


(py37) C:\Users\kspoo>

Thanks, Kelvin

回答1:

Please provide the output from conda list and conda info. We have a thread going on GitHub.

In the meantime, you can try downgrading to the previous build with conda install python=3.7.1=h33f27b4_4.



回答2:

A simple fix is to open Anaconda Prompt in admin mode and run your commands there. It works without any hassle.