I created a new virtual environment:
$ virtualenv --no-site-packages venv --python=python3.2
Then, I activate the virtual environment and install packages:
$ source venv/bin/activate
$ pip install termcolor
$ python -m termcolor
This all works just fine. I then install my own project called Hermes which uses termcolor:
$ python setup.py install
But when I run the executable that's installed to the virtualenv's bin directory, I get an error:
ImportError: no module named termcolor
How do I install termcolor?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With