My guess is that you probably have two versions of Python or downloaded the wrong module.
1)Wrong Module:
pip install term color
It will install a different module. To fix it, install the correct module:
pip install termcolor
2)Two-Versions
If you have two versions of Python, you need to specify it:
i)Two versions of Python 3:
If you two versions of Python3, specify:
pip3.x install termcolor
ii)If you have Python 2 installed:
If you have Python 2 and 3 installed, specify it, as pip works for Python2, and pip3 works for Python 3:
pip3 install termcolor
If you have only Python3, or in simple words only one version of Python, You can follow the first instruction.
Answer from Mahir Islam on Stack OverflowWhat is Python ModuleNotFoundError and what causes it?
How do I fix 'ModuleNotFoundError: No module named X'?
Is ModuleNotFoundError the same as ImportError?
My guess is that you probably have two versions of Python or downloaded the wrong module.
1)Wrong Module:
pip install term color
It will install a different module. To fix it, install the correct module:
pip install termcolor
2)Two-Versions
If you have two versions of Python, you need to specify it:
i)Two versions of Python 3:
If you two versions of Python3, specify:
pip3.x install termcolor
ii)If you have Python 2 installed:
If you have Python 2 and 3 installed, specify it, as pip works for Python2, and pip3 works for Python 3:
pip3 install termcolor
If you have only Python3, or in simple words only one version of Python, You can follow the first instruction.
The simplest way, if you already have termcolor installed to Python3.x and it still has problems when you use programs with #!/usr/bin/env python, is to just copy the termcolor.py file from /usr/lib/python3/dist-packages to /usr/lib/python2.x
Seriously, that's it. No dependencies. Just copy and go.
The error:
ImportError: no module named termcolor
Means you have not installed termcolor. Here is how you install it for Ubuntu:
sudo apt-get install python-pip
sudo pip install termcolor
The exact command to install it for your linux distribution will depend on the package manager. When you're done with that, put this in a python script to make sure it works:
#!/usr/bin/python
from termcolor import colored
print colored('hello', 'red'), colored('world', 'green')
The script should print hello in red, and world in green. Then you know it is installed.
Another python executable must be in the path. Are you doing sudo or does your python file have a #!/usr/bin/env python line or anything? Try python -v and which python to figure out which python you are actually using. Are you running venv/bin/python?