2

我在 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'))

然后它说修改 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
4

3 回答 3

3

您是否尝试过将 PYTHONPATH 设置为 python 的位置?也许这样它就会知道在哪里安装它。

你用python setup.py install. 试试看sudo python setup.py install,如果你正在使用一些 linux 并且你是 sudoer。

于 2010-01-13T14:43:52.550 回答
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/

(这让我有点惊讶,我认为 setup 会构建目录。)

确保您具有在树下写入权限

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。

我希望这种帮助来得太晚,无法帮助原始海报,但我希望它可以帮助其他提出这个问题的人。正如我所做的那样。

于 2011-11-09T05:12:20.423 回答
0

我需要有关您的操作系统的更多详细信息才能给出完全准确的回复。从你的问题的声音来看,你改变了你的 python 路径。通常,您将拥有与您的操作系统兼容的 python 预安装版本。例如,CentOS 5.x 带有 python 2.4,但是你可以做一个yum installpython 2.6。python26安装后,您可以通过命令运行 python 2.6 。

在进行安装和打包时,我建议您尽可能多地使用包管理器,因为它们有助于处理您的依赖关系,例如yum. Yum 还有助于控制更新包,而不必手动进行更新。下一个最好的方法是通过pipor进行安装easy install,在这个问题的情况下,您可以尝试easy_install https://fedorahosted.org/releases/s/u/suds/python-suds-0.4.tar.gz(需要 setuptools),作为最后的手段,您可以尝试手动安装。如果我明白我正在进行手动安装,我觉得我在某个地方失败了:) 其他人已经提供了有关如何手动安装的详细信息。

祝你好运。

于 2015-04-27T21:04:59.120 回答