the issue: running Python's matplotib
from a Windows virtual environment as reported & discussed Github ticket 93 and a relevant suggested fix here.
Code (myp.py
):
import matplotlib.pyplot as pl
import Tkinter as tk
# insert code to read/load mydata
pl.plot(mydata['foo'],mydata['bar'],'*')
Tcl Error:
_tkinter.TclError: Can't find a usable init.tcl in the following directories:
C:/Python27/lib/tcl8.5 C:/Users/Remi/MyVirtEnv/lib/tcl8.5....(ect)
Fix attempt 1: as suggested in ticket above, I added the following env. variables to path in batch file activate.bat
located in C:/Users/Remi/MyVirtEnv/Scripts/
:
set "TCL_LIBRARY=C:\Python27\tcl\tcl8.5"
set "TK_LIBRARY=C:\Python27\tcl\tk8.5"
Not resolved this way. Potentially relevant info: using PyCharm
IDE with the following configuration:
Environment variables: PYTHONUNBUFFERED=1
Python interpreter: python 2.7.10 virtualenv at C:\Users\Remi\MyVirtEnv
"buttons checked": Add content roots and Add source roots to PYTHONPATH
Any help I could get would be much appreciated.
init.tcl
in any of the directories it lists? – Grimonia/Python27/tcl/tcl8.5
. Btw, the ugliest fix for now was to copy/tk8.5
and/tcl8.5
to `C:\Users\Remi\MyVirtEnv\Lib` – Ashmorelibtcl.dll
to not be able to locate the associatedinit.tcl
. There's various reasons why that might happen, but most come down to people moving part of the installation around without moving the rest of it, or using the wrong value in theTCL_LIBRARY
environment variable. I've a long-term fix for this — involving building a combined installation file — but that's still in alpha. – Grimonia