在Google CloudPlatforms中导入

2024-03-28 17:53:54 发布

您现在位置:Python中文网/ 问答频道 /正文

在python应用程序中,我使用matplotlib.when我开始运行它会给我一个错误:

ImportError: No named '_tkinter', please install the python3-tk package

然后我安装了sudo apt-get install python-tk,它在本地主机。但是同样的应用我正在部署到谷歌云平台。但是我得到这个错误:

import _tkinter # If this fails your Python may not be configured for Tk ImportError: libBLT.2.5.so.8.6: cannot open shared object file: No such file or directory

如何将pythontk安装到Google上云平台。之后关闭维图阿伦,我也有已安装。它已经有最新版本了。我试了很多东西,但似乎没有工作。那个应用程序抛出502个坏网关。在

enter image description here

提前谢谢。在


Tags: installtheno应用程序matplotlibtkinter错误平台
1条回答
网友
1楼 · 发布于 2024-03-28 17:53:54

使用

matplotlib.use('agg')

在导入matplotlib之后,在无头环境中渲染matplotlib图形。也可以在matplotlibrc文件中或通过MPLBACKEND环境变量将其设置为默认值。在

有关更多详细信息,请参阅matplotlib文档:https://matplotlib.org/faq/usage_faq.html#what-is-a-backend另请参阅using matplotlib in a web application上的页面。在

相关问题 更多 >