python - What is a general process/concept to determine what to add to PYTHONPATH to resolve import issues? -
i keep running problems unresolved imports in django project (in eclipse w/ pydev). after googling while on given issue can find right thing add pythonpath solve problem. seems i'm missing concept or process can definitively "obviously there should add thing import properly". makes more frustrating i'm following basic django tutorial, i'd expect these things dealt with. in java world pretty clear because can find out library particular package coming from, download , add build path. equivalent concept in python/django world?
i not looking solve specific problem here, rather know steps follow, or up, or concept missing. or possibly find out there not 1 , guesswork...
i running on ubuntu 10.10, python 2.6
from question assume quite new python, let's start @ beginning.
my advice @ traceback django generates , search line looks this: "importerror: no module named somemodule". tells name of missing module.
once know name of module can try see if missing module listed in pypi (python package index) using easy_install.
try running:
easy_install somemodule
if you're lucky missing module installed python installation's site-packages directory (possibly /usr/lib/python2.6/site-packages, depending on python installed). site-packages directory 3rd party modules should installed to, , modules in directory import-able , on pythonpath.
it's possible code trying import not available on pypi, in case google best option :p
p.s. if easy_install doesn't work (or it's missing) it's possible don't have setuptools python module installed, can here: http://pypi.python.org/pypi/setuptools
Comments
Post a Comment