Getting IDLE to use correct Tcl/Tk on MacOSX 10.6?

Ned Deily nad at python.org
Thu Sep 29 17:48:48 EDT 2016


On 2016-09-27 18:47, Gregory Ewing wrote:
> I don't normally use IDLE, but I had occasion to use it
> on MacOSX 10.6 to answer someone's question, and of course
> it didn't work properly due to Apple's broken Tcl/Tk.
> 
> I followed the advice to install ActiveState Tcl 8.5.18.0,
> but my Python still wants to use Apple's Tcl.
> 
> How do I persuade Python to use the new one I've installed?
> It's a framework install of Python 3.5 that I compiled
> myself. Do I need to rebuild it to get it to pick up the
> right Tcl? Or is there an environment variable I can set?

As you probably know, on OS X the dynamic load library paths linked into
executables and the like are normally absolute paths.  This applies to
_tkinter.so.  You can check the path with otool -L.

$ python3.5 -c "import _tkinter; print(_tkinter.__file__)"
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so
$ otool -L $(python3.5 -c "import _tkinter; print(_tkinter.__file__)")
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so:
	/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility
version 8.5.0, current version 8.5.18)
	/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version
8.5.0, current version 8.5.18)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.0)

The ActiveState Tcl/Tk frameworks are installed in /Library/Frameworks;
your _tkinter was linked with the Apple-supplied versions in
/System/Library/Frameworks. If you rebuild _tkinter after the new
versions are in /Library/Frameworks, everything should be just fine,
since, by default, /Library/Frameworks is searched at link time before
/System/Library/Frameworks.  You could also override the search order at
run time for all frameworks with:

DYLD_FRAMEWORK_PATH=/Library/Frameworks

See man dyld for more info.  Or you might be able to use
install_name_tool to modify the path to the framework.






More information about the Python-list mailing list