我在 django 项目中使用 alembic 和 virtualenv,我在路径中创建了一个虚拟环境
/ENV
/myproject
Run Code Online (Sandbox Code Playgroud)
在我的项目中,我有一个 configs/development.ini 文件,在其中定义 alembic 参数
script_location = ../ENV/bin/alembic
Run Code Online (Sandbox Code Playgroud)
当我尝试运行alembic时
alembic -c configs/development.ini upgrade head
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
The 'Mako' distribution was not found and is required by alembic
Run Code Online (Sandbox Code Playgroud)
您需要正确安装 Alembic 及其依赖项(例如 Mako)。在您的 virtualenv 中,运行该命令pip install alembic
,该命令将自动提取每个包的依赖项。