英文:
Requirement.txt file for Render while using conda environment
问题
我是新手,但我正在尝试使用Render的Web服务设置Flask应用程序,我在requirements.txt文件上遇到问题,部署一直失败。
我已经使用conda创建了虚拟环境,并使用"conda list -e > requirements.txt"命令创建了要求文件,但似乎无法使其工作。在服务器端的构建命令中,我尝试了默认选项:$ pip install -r requirements.txt,但没有起作用,以及$ conda install --file requirements.txt,但它没有识别conda命令。我应该怎么做?
英文:
I am new with this stuff but I am trying to set up flask app using Render's web service and I have problem with requirements.txt file and deploying keeps failing.
I have created virtual environment with conda and made requirement file using "conda list -e > requirements.txt" command but can't seem to make it work. As build command in server side I tried default option: $ pip install -r requirements.txt which didnt work and $ conda install --file requirements.txt but it didn't recognize conda command. What should I do?
答案1
得分: 1
conda export 和 pip export 的格式不同。如果你想要以 pip 格式导出依赖项,请使用:
pip freeze > requirements.txt
然后只需使用 pip install -r requirements.txt
如果你想要创建一个新的环境,并使用由 conda 导出的 requirements.txt 文件,请使用:
conda list -e > requirements.txt
然后:
conda create --name <your-new-env> --file <requirements file>
但如果你需要在现有环境中安装依赖项,请使用:
conda install --file <requirements file>
关于为什么无法识别 conda
命令,请提供更多信息更新你的问题,我会相应编辑我的回答。
英文:
conda export and pip export don't have the same format. If you want to export dependencies in pip format use:
pip freeze > requirements.txt
And then just use pip install -r requirements.txt
If you want to make a new env that will use requirements.txt file exported by conda, use:
conda list -e > requirements.txt
and then:
conda create --name <your-new-env> --file <requirements file>
But if you need to install dependencies in an existing env, use the:
conda install --file <requirements file>
As to why it didn't recognize conda
command, please update your question with more info, and I will edit my answer accordingly.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论