admin管理员组文章数量:1122846
I am developing and testing with airflow inside a docker container. The container is created using the image ghcr.io/apache/airflow/main/ci/python3.9
from apache/airflow. Inside the container, airflow and python are installed:
$ which airflow
/usr/local/bin/airflow
$ which python
/usr/local/bin/python
I tried to execute this python script inside the container
$ /bin/python3 /files/dags/play.py
Traceback (most recent call last):
File "/files/dags/play.py", line 1, in <module>
from airflow import DAG
ModuleNotFoundError: No module named 'airflow'
I am developing and testing with airflow inside a docker container. The container is created using the image ghcr.io/apache/airflow/main/ci/python3.9
from apache/airflow. Inside the container, airflow and python are installed:
$ which airflow
/usr/local/bin/airflow
$ which python
/usr/local/bin/python
I tried to execute this python script inside the container
$ /bin/python3 /files/dags/play.py
Traceback (most recent call last):
File "/files/dags/play.py", line 1, in <module>
from airflow import DAG
ModuleNotFoundError: No module named 'airflow'
Share
Improve this question
asked Nov 23, 2024 at 5:08
Rebel AIRebel AI
291 silver badge2 bronze badges
2 Answers
Reset to default 2You are using /bin/python3
instead of /usr/local/bin/python
.
This can lead to the ModuleNotFoundError
.
Try this:
/usr/local/bin/python /files/dags/play.py
or
python /files/dags/play.py
You are using /bin/python3 instead of /usr/local/bin/python. This can lead to the ModuleNotFoundError.
Try this:
/usr/local/bin/python /files/dags/play.py
本文标签: linuxPython ModuleNotFoundError inside Docker containerStack Overflow
版权声明:本文标题:linux - Python `ModuleNotFoundError` inside Docker container - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736299541a1930490.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论