'Virtualenv: TclError Can't find a usable init.tcl
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.
Solution 1:[1]
IDLE was not launching from virtual environment.
After adding the following env. variables to path in batch file activate.bat located in ex: C:/Users/Remi/MyVirtEnv/Scripts/:
set "TCL_LIBRARY=C:\Python27\tcl\tcl8.5" set "TK_LIBRARY=C:\Python27\tcl\tk8.5"
Able to lunch IDLE in Virtual environment.
Make sure the path is proper "C:\Python27\tcl\tcl8.5"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rajkrish06 |
