【问题标题】:How to install python package on GitHub Codespaces without having to rebuild the container?How to install python package on GitHub Codespaces without having to rebuild the container?
【发布时间】:2022-12-27 17:56:38
【问题描述】:
I copied a template codespace https://github.com/github/codespaces-flask and now whenever I need to add a new package pip install redis for example I have to add it to my requirements.txt and rebuild the entire codespace again.
What is the proper way of doing this?
Thank you in advance.
I tried searching GitHub codespaces documentation and following Docker tutorials. I didn't find anything specific enough to answer my question.
【问题讨论】:
标签:
python
flask
pip
codespaces
github-codespaces
【解决方案1】:
Try pip install -t target_directory to install directly into a specified folder
【解决方案2】:
Running pip install package_name in terminal will have the package installed for your current codespace build. You need not rebuild your codespace for those packages to work.
But do also add pip install package_name for all your required packages to your requirements.txt, so that you don't have to manually install these packages the next time you build a new codespace.