I've setup a virtualenv for my existing Django project. So far it only uses django, but now I've tried to install Pisa package. It was installed successfully 开发者_JAVA技巧with pip in virtualenv, but when I try to import its package in django shell I get
No module named ho.pisa
So far I've not found a solution to this problem, moreover there seems to be no such problems for other people.
Could You please help me with this?
Edited: Well, it seems that it is sufficient to add:
import site
vepath = '/path_to_ve_created_for_the_project/lib/python2.6/site-packages'
# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)
And it works. However, is this the cleanest way of doing this?
Are you sure the virtualenv has been activated? Doing that is supposed to add the site-packages
dir to your Pythonpath automatically. You need to do source bin/activate
in the shell before loading Python.
Well, it seems that it is sufficient to add:
import site
vepath = '/path_to_ve_created_for_the_project/lib/python2.6/site-packages'
# add the site-packages of our virtualenv as a site dir
site.addsitedir(vepath)
And it works. However, is this the cleanest way of doing this?
精彩评论