【发布时间】:2014-03-21 21:09:51
【问题描述】:
我正在尝试使用this tutorial 在带有 Digital Ocean 的 Centos 6 VPS 上安装 Python2.7 的 setuptools。当我到达“使用我们安装的 Python (2.7.6) 安装 setuptools”的步骤时,我收到此错误:
[username@hotsname setuptools-1.4.2]$ python2.7 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/local/lib/python2.7/site-packages/test-easy-install-1111.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/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:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
现在,我之前关注instructions on the same digital ocean community site 给执行上述root权限的用户。当我尝试使用 sudo 执行此任务时,我得到:
[username@hostname setuptools-1.4.2]$ sudo python2.7 setup.py install
[sudo] password for username:
sudo: python2.7: command not found
所以我有点困惑。我觉得我可能错过了一些简单的东西。 Digital Ocena 无法对此提供进一步的支持。我已经使用 virtualenv 很长时间了,并且熟悉安装它后该怎么做,我只是被困在这里,因为这是我第一次设置 Centos 主机。你能告诉我我错过了什么吗?
谢谢!
【问题讨论】:
-
你能做到
sudo python(没有2.7)吗?sudo python --version说什么? -
CentOS 可能很傻。尝试更改为 root 用户,而不仅仅是 sudo。
sudo su,然后尝试再次运行python2.7 setup.py install。您可能还必须关闭并重新打开 SSH 连接,以确保环境已正确更新。编辑:看起来该页面还假设您以 root 用户身份运行所有命令。 -
@user1781026,sudo python --version 说:Python 2.6.6,所以我先试试 CasualDemon 的想法……
标签: python setuptools centos6