为什么 python 依赖项没有安装?
我试图创建一个从 github-actions 到 ec2 的 ci-cd 工作流程。但工作流程的一部分不起作用。有一部分我们可以使用 shell 文件安装 python 依赖项。但访问requirements.txt时出现问题。请帮帮我。
这是我的 shell 脚本:
sudo pip3 install virtualenv
cd /home/ec2-user/app/Phalguna
virtualenv environment
source environment/bin/activate
sudo pip3 freeze > requirements.txt
sudo pip3 install -r requirements.txt
这是我的错误:错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:'requirements.txt'
i was trying to create a ci-cd workflow from github-actions to ec2. but a part of the workflow is not working. there is a part where we can install the python dependencies using a shell file. but there is a problem while accessing requirements.txt . please help me out.
this is my shell script:
sudo pip3 install virtualenv
cd /home/ec2-user/app/Phalguna
virtualenv environment
source environment/bin/activate
sudo pip3 freeze > requirements.txt
sudo pip3 install -r requirements.txt
and this is my error: ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'requirements.txt'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如您可以在此处阅读的第一句话:
https://pip.pypa.io/en/stable/cli/pip_freeze/< /a>
您刚刚创建了一个新的虚拟环境,没有安装任何软件包。因此,pip freeze 当然不可能输出应用程序的任何依赖项。您必须在已安装所有软件包的测试环境中执行此操作,并将其与应用程序的其余部分一起发布。
As you can read in the first sentence here:
https://pip.pypa.io/en/stable/cli/pip_freeze/
You have just created a new virtual environment with no installed packages. So pip freeze, of course, cannot possibly output any dependency of your application. You have to do it from your testing environment with all the packages already installed and ship it with the rest of your application.