环境介绍
cenos7
jenkins
python3
报错内容
File "/var/lib/jenkins/workspace/interface-test/common/configEmail.py", line 51, in sendEmail smtpObj = smtplib.SMTP_SSL(mail_host, 465) # 启用SSL发信, 端口一般是465 AttributeError: module 'smtplib' has no attribute 'SMTP_SSL'
解决方法
1.进入Python3安装目录修改Setup和Setup.dist
cd /Python-3.7.7/Modules/
vim Setup
vim Setup.dist
修改内容如下:
备注:Setup 和 Setup.dist 都要改
2.编译
make && make install
3.如果报如下错
4.下载相关依赖
sudo apt-get install libssl-dev
5.再执行编译
make && make install
6.最后测试一下