You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
main方法如下
@hydra.main(config_path='config', config_name="config", version_base='1.1')
def reade_config(cfg):
try:
print(cfg.server)
except Exception as e:
print(f"程序异常: {e}")
finally:
os.system("pause")
使用pyinstaller --onefile --add-data "config/config.yaml;config" main.py 打包成exe文件
运行后报错
File "hydra\main.py", line 99, in decorated_main
File "hydra_internal\utils.py", line 338, in _run_hydra
File "hydra_internal\utils.py", line 190, in create_automatic_config_search_path
File "hydra_internal\utils.py", line 203, in create_config_search_path
File "hydra\core\plugins.py", line 46, in instance
File "hydra\core\singleton.py", line 17, in instance
File "hydra\core\singleton.py", line 13, in call
File "hydra\core\plugins.py", line 54, in init
File "hydra\core\plugins.py", line 71, in _initialize
File "hydra\core\plugins.py", line 186, in _scan_all_plugins
AttributeError: 'PyiFrozenImporter' object has no attribute 'find_module'
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
main方法如下
@hydra.main(config_path='config', config_name="config", version_base='1.1')
def reade_config(cfg):
try:
print(cfg.server)
except Exception as e:
print(f"程序异常: {e}")
finally:
os.system("pause")
使用pyinstaller --onefile --add-data "config/config.yaml;config" main.py 打包成exe文件
运行后报错
File "hydra\main.py", line 99, in decorated_main
File "hydra_internal\utils.py", line 338, in _run_hydra
File "hydra_internal\utils.py", line 190, in create_automatic_config_search_path
File "hydra_internal\utils.py", line 203, in create_config_search_path
File "hydra\core\plugins.py", line 46, in instance
File "hydra\core\singleton.py", line 17, in instance
File "hydra\core\singleton.py", line 13, in call
File "hydra\core\plugins.py", line 54, in init
File "hydra\core\plugins.py", line 71, in _initialize
File "hydra\core\plugins.py", line 186, in _scan_all_plugins
AttributeError: 'PyiFrozenImporter' object has no attribute 'find_module'
Beta Was this translation helpful? Give feedback.
All reactions