【发布时间】:2019-07-29 21:18:37
【问题描述】:
我构建了一个 python 应用程序,它在它的 docker 容器中愉快地运行,直到我添加了一些 http 调用。使用库“请求”。我做了一些研究,alpine linux 3.7 有一个名为“py-requests”的库。只是我似乎无法在我自己的系统上安装它,更改我的代码以使用它,并且只留下“导入请求”就会抛出错误' 在我的代码中。 Py-pip 似乎也不起作用。
【问题讨论】:
-
在构建镜像时使用
pip install requests;有requirements.txtfor Python 你的包。 -
你的问题确实不清楚。
Py-pip doesn't seem to work either,这意味着您已经使用 pip 安装了它?Only I can't seem to install this on my own system,这意味着你已经尝试安装它,命令是什么,如果出错,日志是什么?to change my code to use it, and errors are thrown just leaving 'import requests' in my code,怎么回事?见How to create a Minimal, Reproducible Example -
9000 和@atline 我无法使用 pip install 因为我被公司防火墙阻止了。我将 --proxy mycompanyproxy.com:80 --trusted-host pypi.org --trusted-host files.pythonhosted.org 添加到我的 dockerfile 的 pip install 命令中,并且能够得到我需要的东西。感谢您的评论,抱歉含糊不清,我是菜鸟:)