使用 pip 安装时生产服务器上的权限被拒绝

Permissions denied on production server when using pip install

我正在尝试将包安装到生产服务器上的 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 的管理员?

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

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


使用:sudo pip install cryptography
也许这对你有帮助。

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

pip install  --user  cryptography