Aues6uen11Z / HonkaiHelper

基于图色识别和OCR的崩坏3自动化脚本
MIT License
229 stars 19 forks source link

ModuleNotFoundError: No module named 'event' #2

Closed windskyxb closed 2 years ago

windskyxb commented 2 years ago

在Airtest中运行main.py时报错: "D:\Tools\AirtestIDE\AirtestIDE" pyrunner "C:\Users\winds\Documents\Codes\HonkaiHelper\main.py" [Start running..] [16692] Failed to execute script AirtestIDE Traceback (most recent call last): File "AirtestIDE.py", line 82, in File "AirtestIDE.py", line 58, in main File "app\widgets\code_runner\tracer.py", line 72, in run_pyfile File "C:\Users\winds\Documents\Codes\HonkaiHelper\main.py", line 11, in from event import * ModuleNotFoundError: No module named 'event' [Finished] 然后在cmd中执行pip install event时报错: C:\Users\winds\Documents\Codes\HonkaiHelper>pip install event Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting event Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d7/e9/3f88290f7a6add3e150b04d61cd989d07b0e5394c37f8bbc32d5a2ee263f/event-0.4.3.zip (56 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [7 lines of output] Traceback (most recent call last): File "", line 2, in File "", line 34, in File "C:\Users\winds\AppData\Local\Temp\pip-install-if_500t4\event_fed8eb9d9aba4ff3a2b89fec8b70b6e8\setup.py", line 20 print 'found libevent build directory', best ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print('found libevent build directory', best)? [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details. uTools_1650354375202.png uTools_1650354365368.png 请问要怎么解决呢?

Aues6uen11Z commented 2 years ago

这个event是指我写的event.py,我之前用的是自己的python而非AirtestIDE自带的,也不知道为什么换个解释器就找不到路径了。2种解决方法: 1.在from event import * 前面加一句 sys.path.append(os.getcwd()) 2.自己下一个python,pip install airtest==1.2.4,在AirtestIDE改路径,选项-设置-自定义python.exe路径改成自己下的

话说如果只是使用脚本的话,根本不用AirtestIDE,直接用python运行就好了

windskyxb commented 2 years ago

这个event是指我写的event.py,我之前用的是自己的python而非AirtestIDE自带的,也不知道为什么换个解释器就找不到路径了。2种解决方法: 1.在from event import * 前面加一句 sys.path.append(os.getcwd()) 2.自己下一个python,pip install airtest==1.2.4,在AirtestIDE改路径,选项-设置-自定义python.exe路径改成自己下的

话说如果只是使用脚本的话,根本不用AirtestIDE,直接用python运行就好了

方法1在弹出申请管理员弹窗后就终止了: uTools_1650365210731.png 方法2还是报错: Traceback (most recent call last): File "C:\Users\winds\Documents\Codes\HonkaiHelper\main.py", line 8, in from airtest.cli.parser import cli_setup File "C:\Users\winds\AppData\Local\Programs\Python\Python39\lib\site-packages\airtest\cli\parser.py", line 4, in from airtest.report.report import get_parger as report_parser File "C:\Users\winds\AppData\Local\Programs\Python\Python39\lib\site-packages\airtest\report\report.py", line 15, in from jinja2 import evalcontextfilter, Markup, escape ImportError: cannot import name 'evalcontextfilter' from 'jinja2' (C:\Users\winds\AppData\Local\Programs\Python\Python39\lib\site-packages\jinja2__init__.py) uTools_1650365547882.png uTools_1650365257036.png

Aues6uen11Z commented 2 years ago

方法1试试用管理员方式打开AirtestIDE 方法2的问题可以看下关了的那个issue

windskyxb commented 2 years ago

方法1试试用管理员方式打开AirtestIDE 方法2的问题可以看下关了的那个issue

根据那个issue使用方法2运行成功了,感谢大佬的回答(^_^)