Importerror no module named termcolor : How to Solve ?

Importerror no module named termcolor

Importerror no module named termcolor error comes mainly when termcolor python module is available for import. It means it is not installed. So the clear way to fix this error is to reinstall this module. In some cases, We install it but when we invoke the python script we choose different python interpreter. Anyways in this article, We will explore both the reasons.

Importerror no module named termcolor – (Fix) :

Step 1:

Well, let’s see the first best way to install the termcolor python module. We may install termcolor module using pip python package manager. Let’s see how?

pip install termcolor

It will install the latest stable version for termcolor.

Importerror no module named termcolor
Importerror no module named termcolor

Incase if pip package manager is not compatible in your system, Please install the pip before proceeding the above step. Please run the below command ( For Linux based).

sudo apt-get install python-pip

Step 2:

If you have installed this python package termcolor but still getting the same error. It is confirmed that you are running the python script on a different virtual environment. The easy way to check it is –

python -v

or you may use the below command as an alternative-

which python

It will show you the current version of the Python Interpreter which is selected. If you are explicitly not selecting the python version but current python version is incompatible. There is a strong possibility that your python script is starting from the below line.

#!/usr/bin/env python

Here /usr/bin/env is interpreter path. Either change this path with your desire one. Alternatively, if default python is the required one also, You may simply remove this line.



Now you may easily resolve the bug “Importerror no module named termcolor” . In case you are still stuck somewhere please comment below in the comment box. Our team will be happy to help you. Keep reading !!

Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages, where he and his team share knowledge and help others learn more about data science.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner