0

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 the module using:
python setup.py build
in my shell that i used putty to get into. But when i would run
python setup.py install
it would return an error. Figuring that all install really does is throw the files from the lib dir into the python site-packages folder, i decided to try and manually do it. I was successful in doing so on my local machine and was able to run python and type import lastfm with no errors. But i could not get it working on my webhost.

I do have quite the clusterfuck currently on my webhost due to my n00bism, by that i mean i tried installing python multiple times, and i dont really know where it installed successfully. All i know is i can go to putty and type python and it will run, but i dont know exactly where from. So i copied the lastfm build over to every python2.x/lib/site-packages i could find, but to no avail.

I dont know what im doing wrong. It says pythons os path is usr/lib/python2.5 and i figure usr means the root or local. idk. im very confused.

I also am curious because i am able to import things like mysql and sqlite by typing
import MySQLdb
import sqlite
import sqlite3

and all those work, yet i dont see them anywhere in my python path.

thanks in advance. if i need to list more info please tell me. thanks!

edit:

$ python setup.py install running install error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the installation directory:

[Errno 13] Permission denied: '/usr/lib/python2.5/site-packages/test-easy-install-11740.write-test'

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:

/usr/lib/python2.5/site-packages/

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.

For information on other options, you may wish to consult the documentation at:

http://peak.telecommunity.com/EasyInstall.html

Please make the appropriate changes for your system and try again.


that is the error i would get when i would try to do python setup.py install

4

3 回答 3

0

在某些 Linux 发行版(Debian、Ubuntu)site-packages中不在PYTHONPATH. 您可以将其添加到您的PYTHONPATH、放置链接dist-packages或添加路径配置文件。

文档:修改 Python 的搜索路径

于 2011-02-25T07:38:16.463 回答
0

Python 包在您的PYTHONPATH. 如果你这样做echo $PYTHONPATH

import sys
print sys.path

您将获得导入模块的目录列表。在您使用 python-lastfm 的情况下,您正在使用一个版本的 Python 进行安装,并尝试使用另一个版本运行该程序。当您发现某些东西没有被导入时,这通常是混淆的情况。使用 python 的完整路径/usr/bin/python2.6或执行 awhich python并尝试使用完整路径使用安装脚本构建和安装,然后重试。

于 2011-02-25T07:18:13.043 回答
0

大多数时候,要在任何UNIX基于系统(linux/os x/bsd)上安装 python 包,您需要执行以下操作:

sudo python setup.py install

当然,如果你有 sudo 权限的话。

于 2011-02-25T08:00:19.047 回答