ModuleNotFoundError:没有名为“imp”的模块

问题描述 投票:0回答:1

我需要在 Windows 上安装 eb 命令。

我想尝试使用elasticbeanstalk服务在AWS上部署应用程序,通过这个命令可以直接用配置文件配置和部署环境。

为此,我遵循了指南。我首先通过网站安装了 python(Python 版本 3.12.0),然后安装了指南链接中描述的所有步骤。

现在,如果我从 cmd 运行 eb 命令,我总是会收到此错误。

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Utente\.ebcli-virtual-env\Scripts\eb.exe\__main__.py", line 4, in <module>
  File "C:\Users\Utente\.ebcli-virtual-env\Lib\site-packages\ebcli\core\ebcore.py", line 16, in <module>
    from cement.core import foundation, handler, hook
  File "C:\Users\Utente\.ebcli-virtual-env\Lib\site-packages\cement\core\foundation.py", line 11, in <module>
    from ..core import output, extension, arg, controller, meta, cache, mail
  File "C:\Users\Utente\.ebcli-virtual-env\Lib\site-packages\cement\core\extension.py", line 8, in <module>
    from imp import reload  # pragma: no cover
    ^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'imp'

我尝试了几件事,但无法得出结论。 有谁知道如何帮助我吗?

我也尝试安装以前版本的python,尽管我不喜欢它作为解决方案,但我仍然遇到问题。

python amazon-web-services amazon-elastic-beanstalk
1个回答
0
投票

我也遇到过这种情况。据我了解,这是一个折旧问题。

awsebcli 将与 Python 3.12 一起安装,但 imp 不会。

如果您在 Python 3.11 中输入 import imp,您将得到以下响应

DeprecationWarning: the imp module is deprecated in favour of importlib and 
slated for removal in Python 3.12; see the module's documentation for 
alternative uses

在撰写本文时,此 Electric Beanstalk 仅支持 3.8、3.9 和 3.11

https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.python

© www.soinside.com 2019 - 2024. All rights reserved.