我有一个 Python 脚本,我想在 Docker 容器中运行,但它因错误而停止:
File "main.py", line 1, in <module>
from pushover import init, Client
ImportError: cannot import name 'init' from 'pushover' (/usr/local/lib/python3.8/dist-packages/pushover/__init__.py)
在 PyCharm 中,脚本运行良好。Dockerfile 看起来像这样:
RUN apt-get update -y && apt-get install git python3 python3-pip -y; \
git clone https://(path to my script) ; \
pip3 install pushover
WORKDIR "/FNotify/"
CMD python3 main.py;
我在脚本中的导入如下所示:
from pushover import init, Client
import os
from time import sleep