New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot import _tkinter in Python 3.5 on Windows #68959
Comments
I found out that I cannot import tkinter in Python 3.5.0b4 on 64-bit Windows Vista. Trying to import _tkinter results in ImportError: DLL load failed. On the other hand I have no problem importing _ctypes whose .pyd file is at the same location as _tkinter.pyd. |
64-bit 3.5.0b4 works for me in Windows 7. Try loading _tkinter.pyd in Dependency Walker. Or try loading the dependent DLLs directly via ctypes: import os
import _ctypes
dlls_path = os.path.dirname(_ctypes.__file__)
for d in ('tcl86t.dll', 'tk86t.dll'):
path = os.path.join(dlls_path, d)
try:
_ctypes.LoadLibrary(path)
except OSError:
print('failed:', path) |
It seems that both tcl86t.dll and tk86t.dll can be found, but their dependency VCRUNTIME140.dll cannot. For some reason, Dependency Walker cannot locate also python35.dll and ieshims.dll (but it tries to find all three libraries in Python 3.5\DLLs and at least python35.dll is located directly in Python 3.5 directory). |
Not finding python35.dll is normal since there's no activation context from python.exe. The vcruntime140 library is statically linked to avoid having to distribute vcruntime140.dll. See bpo-24476. This needs to be changed in the TCL/Tk project files as well. |
Correct. I'll fix this on Monday or Tuesday this week. |
Until then, if you find and install the VC distributable for VS 2015 then you'll have the files you need. On my phone now so I don't have the link handy |
New changeset e9f91d47c8ab by Steve Dower in branch '3.5': New changeset 14dee84ab900 by Steve Dower in branch 'default': |
Rather than change the tcl and tk project files (which is not as easy as updating the Python projects - I spent an hour trying), I've added the vcruntime DLL to the MSI with tkinter. Distutils has already been updated to not include it any more, and I really want to avoid having people depend on it since it could break the nice compatibility we have going now, but there's no easy way around it right now. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: