[PYTHON] Resolve No module named tkinter

Background When using yolo, when using BBox-Label-Tool for labeling, the error message No module named _tkinter was displayed (when main.py was executed).

Environment ・ Mac OS Catalina 10.15.6 ・ Python 2.7.16 ・ Tcl-tk 8.6.10

Procedure

Trial and error After checking, it seems that python is reinstalled with pyenv ```brew install tcl-tk```Went However, No module named PIL etc. does not work Apparently, when I execute the python command, it uses the default python.
#It does not match
$pyenv versions
  system
* 2.7.16 (set by /****/****/.pyenv/version)
  3.7.3

$python --version
python 3.7.3
  • This time, I used the same python version of pyenv as the default python version.

Solution Prefer the pyenv path I did the following
$ vim /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/local/sbin
/usr/sbin
/sbin

But it doesn't work

Best Answer Do the following
pyenv init
source ~/.bash_profile

Or

eval "$(pyenv init -)"

that's all

Postscript) -It seems that when you close the terminal, it returns to the initial state. If you write the following in .~ / .bashrc, it will be loaded every time you start it.

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

-BBox-Label-Tool can be used, but it seems that an error occurs even if import tkinter is performed in interactive mode.

Recommended Posts

Resolve No module named tkinter
When lambda-uploader says No module named xxxx.
Today's python error: ModuleNotFoundError: No module named
Suddenly with Python PyInstaller No module named pyinstaller
Today's python error: ModuleNotFoundError: No module named
Django / Apache / mod_wsgi: No module named importlib
ModuleNotFoundError: No module named'***' when running Flask
ModuleNotFoundError in Python: No module named story
Solution for "Import Error: No module named requests"
python> import seiral> ImportError: No module named serial
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
ModuleNotFoundError: No module named'flask_sqlalchemy'
No module named What to do if you get'libs.resources'
[Python] ModuleNotFoundError: No module named'urlparse'
After installing pygame with conda install No module named font
Django, nginx, uWSGI, virtualenv ImportError: No module named site Solution Note
[Solved] ImportError: No module named pyexpat and pyenv install is moss
python / netCDF / CentOS 6.8> ImportError: No module named netCDF4> sudo yum install netcdf4-python.x86_64
Python error: ModuleNotFoundError: No module named'flask'
[Question] No module named'Selenium' in PyCharm
ModuleNotFoundError in poetry: No module named'setuptools'