ModuleNotFoundError:Heroku中的tkinter

时间:2019-05-26 14:37:11

标签: python django heroku tkinter

我有一个使用tkinter包进行文件打开对话框功能的应用程序,该应用程序基于python Django构建。该应用程序在本地运行完全正常。但是,在Heroku中部署后,出现以下错误。

ModuleNotFoundError at /
No module named '_tkinter'
Request Method:
GET
Request URL:
http://compare-files.herokuapp.com/
Django Version:
1.11.20
Exception Type:
ModuleNotFoundError
Exception Value:
No module named '_tkinter'
Exception Location:
/app/.heroku/python/lib/python3.7/tkinter/__init__.py in <module>, line 36
Python Executable:
/app/.heroku/python/bin/python
Python Version:
3.7.3
Python Path:
['/app',
 '/app/.heroku/python/bin',
 '/app',
 '/app/.heroku/python/lib/python37.zip',
 '/app/.heroku/python/lib/python3.7',
 '/app/.heroku/python/lib/python3.7/lib-dynload',
 '/app/.heroku/python/lib/python3.7/site-packages']
Server time:
Sun, 26 May 2019 14:20:26 +0000

代码是:

from tkinter import Tk
from tkinter.filedialog import askopenfilename

    Tk().withdraw()
    file1 = askopenfilename()
    print(file1)

0 个答案:

没有答案