Problem with Python Modules

I upload my first Django application to my Dreamhost server. My application uses xlwt , and since I cannot install it in the default folder (/usr/lib/python2.3/site -packages / xlwt), I installed it in another place:

python setup.py install --home=$HOME

Then xlwt is installed here:

/home/myuser/lib/python/xlwt/

After that I add this folder to env var PYTHONPATH

export PYTHONPATH=$PYTHONPATH:/home/myuser/lib/python

... and in python promt I can do this (no problem)

import xlwt

... But if I do the same in my application code, I have the following error:

Could not import ISI.restaurante.views. Error was: No module named xlwt

[where ISI.restaurante.views is my code, where I do the import]

Could you help me? Thanks!

+3
source share
1 answer

PYTHONPATH , python

import sys
sys.path.append('/home/myuser/lib/python')
+5

Source: https://habr.com/ru/post/1706561/


All Articles