我在python 2.6.4中安装SUDS时遇到了麻烦。我试图安装安装文件,但它说无法找到python的位置。这是因为我改变了python的位置。我试过使用easy_install但是没有运气。有没有人知道一个简单的方法来做这个或有一个链接来清除安装说明。
我输入的命令是:
python setup.py install
我收到的结果是:
running install
error: cannot 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/local/lib/python2.6/site-packages/test-easy-install-9203.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.6/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
如果我必须更改python路径,你究竟是怎么做的。
我已经尝试了一个网站所说的内容,首先是在Python的site-packages目录中创建一个altinstall.pth文件,其中包含以下行:
import os, site; site.addsitedir(os.path.expanduser('~/lib/python2.3'))
然后用dist:修改distutils目录中的distutils.cfg:
[install]
install_lib = ~/lib/python2.3
# This next line is optional but often quite useful; it directs EasyInstall
# and the distutils to install scripts in the user's "bin" directory. For
# Mac OS X framework Python builds, you should use /usr/local/bin instead,
# because neither ~/bin nor the default script installation location are on
# the system PATH.
#
install_scripts = ~/bin
答案 0 :(得分:3)
您是否尝试过将PYTHONPATH设置为python的位置?也许就这样,它会知道,在哪里安装它。
您正在使用python setup.py install
来呼叫它。试试sudo python setup.py install
,如果你使用的是Linux,那你就是sudoer。
答案 1 :(得分:1)
当我安装suds和python-ntlm时,我也得到了这样的消息。我们的站点有一个单独的安装区域,因此我们可以维护多个版本,所以我的第一个安装步骤是
python setup.py install --prefix=/install/suds/suds-0.4
我收到了有关installplace的相同消息。修复:
确保目录中有
mkdir -p /install/suds/suds-0.4/lib/python2.6/site-packages/
(这让我感到惊讶,我认为安装程序会构建目录。)
确保您使用
在树下写入权限chmod -R 775 /install/suds/suds-0.4/lib/python2.6/site-packages/
两者都没有消除这个消息!
最后一步是将安装区域放入PYTHONPATH,然后执行setup.py
export PYTHONPATH=/install/suds/suds-0.4/lib/python2.6/site-packages:$PYTHONPATH
python setup.py install --prefix=/opt/sw/fw/qce/suds/suds-0.4
使用最终的chmod使新安装的文件可读,以防umask设置为限制性的:
chmod 755 /install/suds/suds-0.4/lib/python2.6/site-packages/*
在此之后,我可以启动python并导入suds。关键步骤是将suds site-packages目录放入PYTHONPATH。
我希望这个帮助来得太晚,无法帮助原始海报,但我希望它可以帮助那些来这个问题的其他人。就像我一样。
答案 2 :(得分:0)
我需要您的操作系统的更多详细信息才能提供完全准确的响应。从你的问题的声音,你改变了你的Python的路径。通常,您将拥有与您的操作系统兼容的预安装版本的python。例如,CentOS 5.x附带python 2.4,但是你可以做yum install
的python 2.6。安装后,您可以通过python26
命令运行python 2.6。
在进行安装和打包时,我建议您尝试尽可能多地使用包管理器,因为它们有助于处理您的依赖关系,例如yum
。 Yum还可以帮助控制更新包,而不必手动进行更新。接下来最好的办法是通过pip
或easy install
进行安装,对于这个问题,您可以尝试easy_install https://fedorahosted.org/releases/s/u/suds/python-suds-0.4.tar.gz
(需要setuptools),作为最后的手段,您可以尝试做手动安装。如果我明白我做了手动安装,我觉得我在某处失败了:)
其他人已经详细介绍了如何手动安装。