【问题标题】:Installing requirements.txt inside of a folder in a VScode dev container在 VScode 开发容器的文件夹中安装 requirements.txt
【发布时间】:2021-08-17 12:24:59
【问题描述】:

我正在使用 Microsoft 的 Python 开发容器模板 https://github.com/microsoft/vscode-remote-try-python

它正常工作,我对结构做了一个小改动。我添加了一个名为“project1”的文件夹并将 requirements.txt 文件移动到该文件夹​​。

当我使用此设置更新 .devcontainer 文件时:

{
...
"postCreateCommand": "pip install -r subject-selection/requirements.txt"
...
}

它失败了,说它找不到文件。我做错了什么?

这是文件结构:

.
├── Dockerfile
├── README.md
├── data
└── subject-selection
    ├── Dataset Analysis.ipynb
    ├── __pycache__
    │   └── analysis_utils.cpython-39.pyc
    ├── analysis_utils.py
    ├── download-subjects.py
    ├── out
    ├── requirements.txt
    └── run-placement-analysis.sh

【问题讨论】:

  • 您能否提供有关您的设置的更多信息,例如参考文件夹结构、VS 代码中包的屏幕截图或类似内容?您可以在某处重现该问题以共享链接吗?
  • 我的项目中有类似的结构,并且 postCreateCommand 可以正常工作。

标签: docker visual-studio-code containers


【解决方案1】:

我相信postCreateCommand 从位置/bin/sh 运行,因此在您的情况下,它正在寻找文件“/bin/sh/subject-selection/requirements.txt”。你可能想要这样的东西:

"postCreateCommand": "pip install -r /workspaces/subject-selection/requirements.txt"

【讨论】:

    猜你喜欢
    • 2023-01-27
    • 2015-07-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-12
    • 1970-01-01
    • 2020-03-18
    相关资源
    最近更新 更多