【问题标题】:Permissions denied on production server when using pip install使用 pip install 时生产服务器上的权限被拒绝
【发布时间】:2016-06-08 14:14:41
【问题描述】:

我正在尝试在生产服务器上将软件包安装到我的 Django 应用程序中,并且收到权限被拒绝错误。下面是回溯。我已经使用 pip install 安装了其他软件包,它没有给我任何问题,所以我不完全确定我为什么会遇到这个问题。

[humanlink@web526 ~]$ pip install cryptography
Collecting cryptography
  Using cached cryptography-1.4.tar.gz
Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in ./lib/python2.7 (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in ./lib/python2.7 (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in ./lib/python2.7 (from cryptography)
Collecting setuptools>=11.3 (from cryptography)
  Using cached setuptools-22.0.5-py2.py3-none-any.whl
Collecting enum34 (from cryptography)
  Using cached enum34-1.1.6-py2-none-any.whl
Collecting ipaddress (from cryptography)
  Using cached ipaddress-1.0.16-py27-none-any.whl
Collecting cffi>=1.4.1 (from cryptography)
  Using cached cffi-1.6.0.tar.gz
Collecting pycparser (from cffi>=1.4.1->cryptography)
  Using cached pycparser-2.14.tar.gz
Installing collected packages: setuptools, enum34, ipaddress, pycparser, cffi, cryptography
  Found existing installation: setuptools 2.1
    Uninstalling setuptools-2.1:
Exception:
Traceback (most recent call last):
  File "/home/humanlink/lib/python2.7/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/humanlink/lib/python2.7/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/home/humanlink/lib/python2.7/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 736, in install
    requirement.uninstall(auto_confirm=True)
  File "/home/humanlink/lib/python2.7/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 742, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/home/humanlink/lib/python2.7/pip-8.1.2-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/home/humanlink/lib/python2.7/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/usr/lib64/python2.7/shutil.py", line 302, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/easy_install-2.7'

我如何找出用户是谁?如果我想将用户设置为我,生产服务器的用户是谁?会是我当前在计算机上登录的用户吗?还是托管我的域的公司 Webfaction 的管理员?

【问题讨论】:

  • 你试过sudo
  • 是的,它是说我不能使用 sudo,因为我的生产服务器上的应用程序不在 sudoers 列表中
  • "humanlink 不在 sudoers 文件中。此事件将被报告。"那是确切的错误

标签: python django pip production


【解决方案1】:

你应该是 root 才能在系统范围内安装,如果你不能,你可以这样做

pip install  --user  cryptography

【讨论】:

  • 哇,它做到了,谢谢。那么 --user 标志的作用是什么?
  • 基本上,它会将库安装在您的~/.local/ 文件夹而不是/usr/ 文件夹中,因此您无需root 即可在此处复制文件。
【解决方案2】:

你在谷歌上搜索过这个问题吗?

试试这个: https://community.webfaction.com/questions/16163/getting-permission-denied-trying-to-install-sqlalchemy

或

使用:sudo pip install cryptography。
可能对你有帮助。

【讨论】:

  • 是的,我有,不幸的是,所有的答案基本上都在说使用 sudo,但是由于我在生产服务器上,在 webfaction 上,而不是在我的本地计算机上,你不能 sudo 任何东西,因为应用程序on webfaction 不在 sudoers 列表中。
  • 试试this .
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-03-12
  • 2012-03-04
  • 1970-01-01
  • 2013-12-29
  • 2018-08-04
  • 2015-08-19
  • 1970-01-01
相关资源
最近更新 更多