Running a python script creates: ImportError: there is no module named termcolor

I created a new virtual environment:

$ virtualenv --no-site-packages venv --python=python3.2

Then I activate the virtual environment and install the packages:

$ source venv/bin/activate
$ pip install termcolor
$ python -m termcolor

It all works great. Then I install my own project called Hermes, which uses termcolor:

$ python setup.py install

But when I run the executable that is installed in the virtualenv bin directory, I get an error message:

ImportError: no module named termcolor

How to install termcolor?

+5
source share
4 answers

python . sudo python #!/usr/bin/env python - ? python -v which python , . venv/bin/python?

+2

:

ImportError: no module named termcolor

, termcolor. Ubuntu:

sudo apt-get install python-pip
sudo pip install termcolor

Linux . , python script, , :

#!/usr/bin/python
from termcolor import colored
print colored('hello', 'red'), colored('world', 'green')

script , - . , .

+6

, env , ! , , , env, , , .

0
source

If you are in windows, you can use this, for example:

windows 7, 32 bit [launch your cmd]

 - set path=%path%;c:Python27
 - cd downloads
 - cd termcolor-1.1.0
 - python setup.py install
0
source

All Articles