PyInstaller fails on Windows 7: “Can't find a usable init.tcl”

后端 未结 3 581
一生所求
一生所求 2020-12-12 03:39

I have a basic Python script which uses Tkinter.

from Tkinter import Tk
from tkFileDialog import askdirectory
Tk().withdraw()
print askdirectory()

3条回答
  •  情书的邮戳
    2020-12-12 04:07

    As RedPhantom mentioned, PyInstaller has a known issue with Tkinter applications on Windows 7 and Windows XP.

    Since this issue has gone unfixed for two years, I've gone ahead and started a bounty on Bountysource. Until the issue is fixed, there are a few workarounds you can try:

    Workaround 1 - Manually copy missing files

    As mentioned in a related issue, you can manually copy the missing files from your local Python installation.

    1. Find your local Python installation. (%LocalAppData%\Programs\Python)
    2. Make a copy of the missing folder (...\Python36-32\tcl\)
    3. Move the copy to your application's tcl folder (...\dist\\tcl\)

    Workaround 2 - Run with --onefile

    Running PyInstaller in --onefile mode seems to avoid this issue.

    However, note that running in single file mode will increase startup time.

    Workaround 3 - Downgrade to PyInstaller 3.1.0

    pip install pyinstaller==3.1.0
    

    According to ugoertz, downgrading to PyInstaller 3.1.0 resolved the issue.

    Downgrading to 3.1.0 (and also downgrading setuptools to 19.2 because of the problem described in #1941) fixed the issue for me.

提交回复
热议问题