在VScode开发容器的文件夹中安装requirements.txt



我正在使用微软的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

我相信postCreateCommand从位置/bin/sh运行,所以在您的情况下,它正在寻找文件'/bin/sh/subject-selection/requirements.txt'。您可能想要这样做:

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

最新更新