尝试安装 python 模块时出现拒绝访问消息

Access denied message when tried to install python module

当我尝试使用 pip 在 python 中安装 oauth 模块时

pip install oauth

我收到这个错误

Downloading/unpacking oauth
Downloading oauth-1.0.1.tar.gz
Running setup.py (path:/tmp/pip_build_mounarajan/oauth/setup.py)    egg_info for package oauth

Installing collected packages: oauth
  Running setup.py install for oauth
  error: could not create '/usr/local/lib/python2.7/dist-  packages/oauth': Permission denied
  Complete output from command /usr/bin/python -c "import setuptools,  tokenize;__file__='/tmp/pip_build_mounarajan/oauth/setup.py';exec(compile( getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),  __file__, 'exec'))" install --record /tmp/pip-N_OqTH-record/install- record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/oauth

copying oauth/__init__.py -> build/lib.linux-x86_64-2.7/oauth

copying oauth/oauth.py -> build/lib.linux-x86_64-2.7/oauth

running install_lib

creating /usr/local/lib/python2.7/dist-packages/oauth

error: could not create '/usr/local/lib/python2.7/dist-  packages/oauth': Permission denied

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools,    tokenize;__file__='/tmp/pip_build_mounarajan/oauth/setup.py';exec(compile( getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),   __file__, 'exec'))" install --record /tmp/pip-N_OqTH-record/install- record.txt --single-version-externally-managed --compile failed with error  code 1 in /tmp/pip_build_mounarajan/oauth
Storing debug log for failure in /home/mounarajan/.pip/pip.log

如何更改 python 目录的权限?

当我尝试使用 pip 安装任何模块时出现这个问题

您可能希望使用 sudo 通过 pip 安装模块。