Use 'pkg-config' instead of heuristics to find 'tk' flags. --- matplotlib-1.4.3/setupext.py.orig 2015-12-01 14:21:19.554417453 +0100 +++ matplotlib-1.4.3/setupext.py 2015-12-01 14:35:51.999928797 +0100 @@ -1457,7 +1457,7 @@ p = subprocess.Popen( '. %s ; eval echo ${%s}' % (file, varname), shell=True, - executable="/bin/sh", + executable="sh", stdout=subprocess.PIPE) result = p.communicate()[0] return result.decode('ascii') @@ -1601,8 +1601,15 @@ # of distros. # Query Tcl/Tk system for library paths and version string + def getoutput(s): + ret = os.popen(s).read().strip() + return ret try: - tcl_lib_dir, tk_lib_dir, tk_ver = self.query_tcltk() + #tcl_lib_dir, tk_lib_dir, tk_ver = self.query_tcltk() + pkg_config_res = getoutput('pkg-config --libs tk').split() + tk_ver = pkg_config_res[-1][-3:] + tcl_lib_dir = pkg_config_res[0][2:] + '/tcl' + tk_ver + tk_lib_dir = pkg_config_res[1][2:] + '/tk' + tk_ver except: tk_ver = '' result = self.hardcoded_tcl_config()