Python Not Importing
Solution 1:
Python packages are searched in your PYTHONPATH
. If you do echo $PYTHONPATH
or
import sys
print sys.path
you will get a list of directories from where the modules are being imported.
In your case with python-lastfm, you are installing using one version of Python and trying to run the program using another version. This is most often the case of confusion when you find that something is not getting imported. Use the full path of python /usr/bin/python2.6
or do a which python
and try to use full path to build and install using setup script and try again.
Solution 2:
In some Linux-Distributions (Debian, Ubuntu) site-packages
is not in PYTHONPATH
. You could add it to your PYTHONPATH
, place a link in dist-packages
or add a path configuration file.
Documentation: Modifying Python’s Search Path
Solution 3:
Most of the time, to install python packages on any UNIX
based system (linux/os x/bsd) you need to do:
sudo python setup.py install
This is, of course, if you have sudo rights.
Post a Comment for "Python Not Importing"