【发布时间】:2022-05-09 06:33:03
【问题描述】:
我必须使用顶层目录中的 -m 选项将散景脚本作为模块运行,因为它需要在同一目录下导入一些其他可移植模块
python -m bokeh_module.bokeh_sub_module
目录树如下所示。通过运行上述命令,无论将png文件放在哪里,它都不会显示图像,有没有办法解决这个问题?感谢您的帮助。
.
├── other_module
│ ├── __init__.py
│ └── other_sub_module.py
├── bokeh_module
│ ├── __init__.py
│ ├── image.png # not showing
│ └── bokeh_sub_module.py
└── image.png # not showing either
bokeh_sub_module.py
from other_module import other_sub_module
from bokeh.plotting import figure, show
# do something with other_sub_module
p = figure(match_aspect=True)
p.image_url( ['image.png'], 0, 0, 1, 1 ) # not showing
p.image_url( ['./bokeh_module/image.png'], 0, 0, 1, 1 ) # not showing either
show(p)
顺便说一句,如果我从bokeh_module目录运行python bokeh_sub_module.py,可以找到同一目录下的image.png,没有问题。
【问题讨论】:
标签: module windows-10 package bokeh python-3.7