【问题标题】: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.

      【讨论】:

        猜你喜欢
        • 2022-12-02
        • 2022-12-26
        • 2022-12-02
        • 2022-12-02
        • 2022-12-26
        • 1970-01-01
        • 2022-12-19
        • 2022-12-27
        • 2022-12-02
        相关资源
        最近更新 更多