我需要安装https://pypi.python.org/pypi/PasteScript在没有 sudo 访问权限的虚拟机上( this one ,如果相关)。我已经下载了它,但是当我运行 python setup.py install
时,我得到:
running install Checking .pth file support in /usr/local/lib/python2.7/dist-packages/ 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/dist-packages/test-easy-install-1621.pth'
The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:
/usr/local/lib/python2.7/dist-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.
我发现的一个替代建议是使用 pip,但如果没有 sudo,我无法安装 pip。
PS:类似的问题有很多,但没有(我能找到!
最佳答案
关于:
python setup.py install --user
正如文档中所述,它应该按您的预期工作:https://docs.python.org/2/install/#alternate-installation-the-user-scheme
关于python - 如何在没有 sudo 的情况下安装下载的 Python 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49224272/