Alexxio
Alexxio

Reputation: 1101

Import error with django_cups

I am using django_cups in my project, and I am getting import error in the models line 4. Here is the models.py file

python ./manage.py runserver

...
File "/home/lex/myapp/django_cups/models.py", line 4, in <module>
import cups
ImportError: No module named cups

I have django_cups installed because when I import cups in the python shell it doesn't complain.

lex@lex-pc:~/django/mykapp$ python
Python 2.7.4 (default, Apr 19 2013, 18:32:33) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cups
>>> 
>>> 

But when I do it in the InteractiveConsole for Django, it complains...

(env)lex@lex-pc:~/django/myapp$ python ./manage.py shell
Python 2.7.4 (default, Apr 19 2013, 18:32:33) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import cups
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named cups
>>> 

What could be the issue here?

Upvotes: 0

Views: 304

Answers (1)

Koterpillar
Koterpillar

Reputation: 8104

The virtual environment, by default, does not include the system packages. To use both system and local packages, use virtualenv --system-site-packages when creating the environment.

Upvotes: 2

Related Questions