Win7/Windows2008R2安装Python3
笺注:这是在Windows2008R2上进行安装,在Win7上的安装也如出一辙。先安装Win7和Windows2008R2的SP1:(软件有32位/64位之分)
[attach]7022[/attach]
32位软件:[url]https://pan.baidu.com/s/1CLN9taftykkK2S73U-f4-A[/url] 提取码:b31g
64位软件:[url]https://pan.baidu.com/s/1Me4C3kbEL7mLXP05LMzc-g[/url] 提取码:lp0t
备注:两个软件在win7和Windows2008R2是通用的
[attach]7023[/attach]
[attach]7024[/attach]
[attach]7025[/attach]
######
安装Python3:(软件有32位/64位之分)
[attach]7026[/attach]
要先勾选“Add Python 3.6 to PATH”:
[attach]7027[/attach]
安装成功了:
[attach]7028[/attach]
运行Python程序:
[attach]7029[/attach]
[attach]7030[/attach]
######
安装Notepad++编辑器:(根据提示,下一步接下一步就安装好了)
[attach]7031[/attach]
百度网盘下载:[url]https://pan.baidu.com/s/1IE-xe38EBv6bHJqbSzPitQ[/url] 提取码:6q8u
使用Notepad++编辑器创建一个Python脚本:
选择语言:
[attach]7032[/attach]
选择编码:
[attach]7033[/attach]
写一个发送邮件的脚本:(使用126邮箱的25端口)
#coding=utf-8
import smtplib #以下3个模块都是内置的,不用额外安装
from email.mime.text import MIMEText
from email.utils import formataddr
my_sender = 'j13680432782@126.com' #发件人邮箱账号
my_pass = 'Jackyxxxx' #发件人邮箱密码
my_name = 'zhuohua' #发件人邮箱昵称
receiver = '2270168881@qq.com' #收件人邮箱账号
receiver_name = 'Python' #收件人昵称
def func_mail():
try:
Key_1 = '邮件正文内容,Welcome to zhuohua.' #邮件的正文内容
Message_1 = MIMEText(Key_1, 'plain', 'utf-8')
Message_1['From'] = formataddr([my_name,my_sender])
Message_1['To'] = formataddr([receiver_name,receiver])
Message_1['Subject'] = "126邮箱的25端口测试邮件" #邮件的主题
server = smtplib.SMTP()
server.connect("[color=Blue]smtp.126.com[/color]",[color=DarkRed]25[/color]) #发件人邮箱的SMTP服务器,端口是TCP 25
server.login(my_sender, my_pass)
server.sendmail(my_sender,[receiver,],Message_1.as_string())
server.quit()
except Exception as e:
print (f"发送邮件失败,原因: {e}")
else:
print("Welcome to zhuohua.")
print("邮件发送成功。")
if __name__ == '__main__':
func_mail()
保存:
[attach]19233[/attach]
[attach]7035[/attach]
Python脚本创建成功:
[attach]7036[/attach]
######
运行Python脚本:
[attach]7037[/attach]
先切换到脚本所在目录:
C:\Users\Administrator>[color=Blue]cd Desktop[/color]
运行Python脚本:
C:\Users\Administrator\Desktop>[color=Blue]python xx.py[/color]
[color=Purple]Welcome to zhuohua.
邮件发送成功。[/color]
如下图:(按以上的配置,脚本是支持中文的)
[attach]19234[/attach]
QQ邮箱收到的邮件:
[attach]19235[/attach]
相关文章:
[url=http://blog.zhuohua.store/viewthread.php?tid=141&page=1&extra=#pid142]Windows使用第三方库psutil[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=178&page=1&extra=#pid179]Python3使用绘图库 Matplotlib[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=146&extra=page%3D1]Python3使用126邮箱的25端口发送邮件[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=186&page=1&extra=#pid187]Win10安装Python3[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=121&page=1&extra=#pid122]Windows2012R2安装Python3[/url]
[url=http://blog.zhuohua.store/viewthread.php?tid=119&extra=page%3D1]CentOS6安装Python3[/url]
页:
[1]