gpt4 book ai didi

python - Predix:没有名为 _tkinter 的模块

转载 作者:行者123 更新时间:2023-11-30 22:37:34 27 4
gpt4 key购买 nike

我正在尝试在 Predix 上推送 Python 微服务。
该代码具有 matplotlib 依赖性。

对于具有以下堆栈跟踪的应用程序,

cf Push 失败。

2017-05-08T19:39:51.43+0530 [App/0]      ERR Traceback (most recent call last):
2017-05-08T19:39:51.43+0530 [App/0] ERR File "server.py", line 7, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR from services.testService import TestServiceOptimalFrequencyForward as TestService
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/home/vcap/app/services/testService.py", line 12, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR from models import test
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/home/vcap/app/models/test.py", line 5, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR from models import model1, model2, model3, pvt
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/home/vcap/app/models/model2.py", line 23, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR import matplotlib.pyplot as plt
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
2017-05-08T19:39:51.43+0530 [App/0] ERR globals(),locals(),[backend_name],0)
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
2017-05-08T19:39:51.43+0530 [App/0] ERR from six.moves import tkinter as Tk
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/six.py", line 203, in load_module
2017-05-08T19:39:51.43+0530 [App/0] ERR mod = mod._resolve()
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/six.py", line 115, in _resolve
2017-05-08T19:39:51.43+0530 [App/0] ERR return _import_module(self.mod)
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/site-packages/six.py", line 82, in _import_module
2017-05-08T19:39:51.43+0530 [App/0] ERR __import__(name)
2017-05-08T19:39:51.43+0530 [App/0] ERR File "/app/.heroku/python/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
2017-05-08T19:39:51.43+0530 [App/0] ERR import _tkinter # If this fails your Python may not be configured for Tk
2017-05-08T19:39:51.43+0530 [App/0] ERR ImportError: No module named _tkinter
2017-05-08T19:39:51.53+0530 [App/0] OUT
2017-05-08T19:39:51.57+0530 [DEA/55] ERR Instance (index 0) failed to start accepting connections

我正在使用python_buildpack

预先感谢您为解决此问题提供的任何帮助。

最佳答案

Python 构建包支持使用 Conda 包管理器而不是 pip。您可能想尝试一下。

http://docs.cloudfoundry.org/buildpacks/python/#miniconda

使用它,我能够将使用 Matplotlib 的示例应用程序部署到 CF。

https://github.com/ihuston/python-cf-examples/tree/master/02-pydata-spyre-app

希望有帮助!

关于python - Predix:没有名为 _tkinter 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43850044/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com