当我在容器内部时,以下操作有效:
pip uninstall -y -r <(pip freeze)
但是当我尝试像这样在Dockerfile中执行相同的操作:
RUN pip uninstall -y -r <(pip freeze)
我会收到以下错误:
------
> [ 7/10] RUN pip uninstall -y -r <(pip freeze):
#11 0.182 /bin/sh: 1: Syntax error: "(" unexpected
------
executor failed running [/bin/sh -c pip uninstall -y -r <(pip freeze)]: exit code: 2
我该如何重写这个命令才能使其正常运行?
编辑:
我正在使用这个解决方法。但我仍然对短一点的答案感兴趣。
RUN pip freeze > to_delete.txt
RUN pip uninstall -y -r to_delete.txt
RUN pip uninstall -y -r <\(pip freeze\)
- spinkus这不起作用,我得到了以下错误信息:`------ > [ 7/10] RUN pip uninstall -y -r <(pip freeze): #11 0.206 /bin/sh: 1: cannot open (pip: No such file
executor failed running [/bin/sh -c pip uninstall -y -r <(pip freeze)]: exit code: 2` - GlaceCeleryRUN pip uninstall plotly -y
。 - GlaceCelerysh
andbash
的副本。 - tripleee