我在开发过程中一直使用pipenv,但是在prod中我需要使用pips requirements.txt
我使用以下命令将pipenv转储到一个requirements.txt文件:
$ pipenv lock -r > requirements-new.txt;一切都很好,直到我需要psycopg2>=2.7 --no-binary psycopg2出现在我的requirements.txt中。
如何在转储到requirements.txt时调整pipenv以指定--no-binary?
我试过了(但不起作用):
export PIP_NO_BINARY=:psycopg2: && pipenv install psycopg2==2.7作为一种临时措施,我使用:
pipenv lock -r > requirements-new.txt;
PSYCOPG_VERSION=$(sed -n -e 's/^.*psycopg2-binary==//p' requirements-new.txt);
sed -i "s|psycopg2-binary==$PSYCOPG_VERSION|psycopg2==$PSYCOPG_VERSION --no-binary psycopg2|" requirements-new.txt;但一定有更好的办法吧?
发布于 2019-07-15 20:50:48
pipenv支持任何PIP变量,因此通过PIP_支持大多数pip选项。
我认为您的错误是在psycopg2周围指定冒号。对于":any:“和":none:”等特殊值,冒号是必需的。对于常规包,只需列出它们的名称,用逗号分隔。
来自:https://pip.pypa.io/en/stable/reference/pip_install/#cmdoption-no-binary
--no-binary不使用二进制包。可以多次提供,每次都会添加到现有值中。接受: all :禁用所有二进制包,:none:清空集合,或者接受一个或多个包名称,包名称之间有逗号。请注意,有些软件包很难编译,当在它们上使用此选项时可能无法安装。
https://stackoverflow.com/questions/56808722
复制相似问题