使用诗歌 python 项目使用 gdown 下载大文件时如何定位到正确的解释器?

发布于 2025-01-14 04:00:21 字数 694 浏览 2 评论 0原文

我正在诗歌 python 项目中使用 gdown 从 Google Drive 下载大文件。执行chmod +x bin/download_model和bin/download_model后,我收到错误的解释器:权限被拒绝错误。在我的项目根目录中,我有文件夹 bin 和 asset,并且在 bin 文件夹中,文件 download_model 使用以下命令生成:

#!/home/user/.cache/pypoetry/virtualenvs/my_project-67vF9gQQ-py3.9 python
import gdown

gdown.download(
    "https://drive.google.com/uc?id=1V8itWtowCYnb2Bc9KlK9SxGff9WwmogA",
    "assets/model_state_dict.bin",
)

我如何定位到正确的解释器,我正在使用的解释器是 poetry env info -- path 命令检索。

这是我得到的日志:

bash: bin/download_model: /home/user/.cache/pypoetry/virtualenvs/my_project-analysis-67vF9gQQ-py3.9: wrong interpreter: Permission denied

I'm using gdown for downloading a large file from Google Drive within a poetry python project. After executing chmod +x bin/download_model and bin/download_model, I got a wrong interpreter: Permission denied error. In my project root I have the folders bin and assets and within bin folder the file download_model yields with this comands:

#!/home/user/.cache/pypoetry/virtualenvs/my_project-67vF9gQQ-py3.9 python
import gdown

gdown.download(
    "https://drive.google.com/uc?id=1V8itWtowCYnb2Bc9KlK9SxGff9WwmogA",
    "assets/model_state_dict.bin",
)

How can I target to the right interpreter, the one I'm using is the one that poetry env info --path command retrieves.

This is the log I got:

bash: bin/download_model: /home/user/.cache/pypoetry/virtualenvs/my_project-analysis-67vF9gQQ-py3.9: wrong interpreter: Permission denied

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缱倦旧时光 2025-01-21 04:00:21

据我了解,问题是您没有激活虚拟环境。

要激活它,您可以使用工作 venv 连接到新 shell 或通过会话激活它。

1.

poetry shell
source /home/user/.cache/pypoetry/virtualenvs/my_project-analysis-67vF9gQQ-py3.9/bin/activate

As I understood, the problem is that you didn't activated your virtual environment.

To activate it you may either connect to a new shell with working venv or activate it through your session.

1.

poetry shell
source /home/user/.cache/pypoetry/virtualenvs/my_project-analysis-67vF9gQQ-py3.9/bin/activate
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文