无法使用.bat文件激活虚拟环境

发布于 2025-02-05 19:51:16 字数 427 浏览 1 评论 0原文

突然的任务调度程序都停止了工作。 挖掘详细信息,由于某种原因,批处理文件似乎没有激活虚拟环境。

Manually running the below command in powershell works fine.
.\.venv\Scripts\Activate.ps1

但是,手动运行.bat文件给我“ ModulenotFoundError”错误,因为VENV没有被激活。

set OdenImports=OdenImports
start "C:\Users\path\MyReports\.venv\Scripts\python.exe" && "C:\Users\path\MyReports\main.py" %1 %OdenImports%

为什么突然它停止工作,我该如何修复?

All of the sudden task scheduler stopped working.
Digging into details, seems like batch file is not activating virtual environment for some reason.

Manually running the below command in powershell works fine.
.\.venv\Scripts\Activate.ps1

However, manually running .bat file gives me "ModuleNotFoundError" error, because venv is not activated.

set OdenImports=OdenImports
start "C:\Users\path\MyReports\.venv\Scripts\python.exe" && "C:\Users\path\MyReports\main.py" %1 %OdenImports%

Why all of the sudden it stopped working and how can I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文