在使用python virtual environment的smtplib的时候,发现smtplib.SMTP_SSL('smtp.163.com', 465)报错:
>>> import smtplib
>>> smtplib.SMTP_SSL('smtp.163.com', 465)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SMTP_SSL'
但是在非venv下没问题,参考了:https://exp.newsmth.net/topic/article/e35eea6efe28f9c03ddae30f6a2fba52,发现可能是import ssl出错,于是import ssl,报错:
>>> import ssl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/ssl.py", line 61, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: /lib/x86_64-