Skip to content Skip to sidebar Skip to footer

Python Not Importing

So i downloaded the lastfm api for python made by people. found here: http://code.google.com/p/python-lastfm/ I have a website hosting through dreamhost. I wasnt able to build th

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"