带有pyautogui的.pyx脚本在spyder/cmd中工作,但不能从bat文件工作



MY pyx 脚本在 spyder 和 cmd 中使用 pyautogui,但不是作为 bat 文件。

proba.pyx

import pyautogui as p
p.alert('Foo')

斯皮德F9作品
CMD works: E:\Anyagok\Programozas\Python\projekts\gyak>proba.pyx
蝙蝠文件:
@py.exe E:\Anyagok\Programozas\Python\projekts\gyak\proba.pyx %*

    c:Program Files (x86)Microsoft Visual StudioSharedPython36_64python.exe:  
 can't open file '<unprintable file name>': [Errno 2] No such file or directory

另一个例子,urge.pyx

import webbrowser
import pyautogui as py
urls=['http://animepill.com/anime/sword-art-online/episodes',
     'http://animepill.com/anime/shingeki-no-kyojin/episodes',
     'http://animepill.com/anime/one-punch-man/episodes',
     'http://animepill.com/anime/boku-no-hero-academia/episodes',
     'http://animepill.com/anime/overlord/episodes',
     ]
for url in urls:
    webbrowser.open(url)
py.alert("""Sword of Art: NoPMO, 0408 vasárnap: 2. rész
         Overlord: nyitás
         többi: urge
         VALSALVA vagy egyél közben...""",'urge')

E:\Anyagok\Programozas\Python\projekts\elo\mindennap>urge.pyx WORKS
斯皮德作品

但在蝙蝠中它说:
@py.exe E:\Anyagok\Programozas\Python\projekts\elo\mindennap\urge.pyx %*

 [...]
import pyautogui as py
ModuleNotFoundError: No module named 'pyautogui'.

打开pyx的默认程序是这个顺便说一句:'e:\Download\PROGIK\Anaconda2\pythonw.exe'
我不得不安装Visual Studio Community Python环境,因为pyx文件由于"无法找到vcvarsall.bat"错误而在spyder中不起作用。现在一切都可以在 spyder 和 CMD 中运行,但带有 pyautogui 的脚本在 bat 中不起作用。

正如@Eric所说:必须在批处理文件中更改为@py.exe@e:\Download\PROGIK\Anaconda2\pythonw.exe

相关内容

最新更新