如何在OSX上安装pyperclip

时间:2017-07-01 04:05:04

标签: python macos pip

当我使用命令“pip install pyperclip”时,它给了我这个错误

creating /Library/Python/2.7/site-packages/pyperclip
    error: could not create '/Library/Python/2.7/site-packages/pyperclip': Permission denied

----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/ts/tdt25dd52pg6ymt1tc1djd540000gn/T/pip-build-QWGKB1/pyperclip/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/ts/tdt25dd52pg6ymt1tc1djd540000gn/T/pip-sfvxg3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/ts/tdt25dd52pg6ymt1tc1djd540000gn/T/pip-build-QWGKB1/pyperclip/

为什么我没有得到许可。

2 个答案:

答案 0 :(得分:2)

尝试

  

sudo pip install pyperclip

现在,如果它抛出一些访问拒绝错误,请尝试:

  

sudo pip -H install pyperclip

答案 1 :(得分:1)

当你遇到错误Permission denied时,因为你试图使用普通命令访问root。因此,尝试以root身份运行命令以消除Permissin denied错误。运行sudo command,即sudo pip install pyperclip