python - 使用PyCharm,似乎无法导入Pyperclip模块

标签 python pyperclip

当我输入pip install pyperclip时,我得到:

Collecting pyperclip
  Using cached pyperclip-1.5.27.zip
Installing collected packages: pyperclip
  Running setup.py install for pyperclip ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/70/2rxbr83d37xgqtk215y88p_m0000gn/T/pip-build-0mgGiQ/pyperclip/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/70/2rxbr83d37xgqtk215y88p_m0000gn/T/pip-7v2hjv-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/pyperclip
    copying pyperclip/__init__.py -> build/lib/pyperclip
    copying pyperclip/clipboards.py -> build/lib/pyperclip
    copying pyperclip/exceptions.py -> build/lib/pyperclip
    copying pyperclip/windows.py -> build/lib/pyperclip
    running install_lib
    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/70/2rxbr83d37xgqtk215y88p_m0000gn/T/pip-build-0mgGiQ/pyperclip/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/70/2rxbr83d37xgqtk215y88p_m0000gn/T/pip-7v2hjv-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/70/2rxbr83d37xgqtk215y88p_m0000gn/T/pip-build-0mgGiQ/pyperclip/

最佳答案

您无法创建必要的目录。要么这样做:

sudo pip install paperclip

或者更好的首选解决方案,安装virtualenv。有很多这样的例子,链接如下:

http://docs.python-guide.org/en/latest/dev/virtualenvs/

关于python - 使用PyCharm,似乎无法导入Pyperclip模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39886467/

相关文章:

python - 无法导入 Pyperclip

python - Pyperclip 的奇怪行为

python - 从不同大小的 numpy 数组创建 pandas 数据框

python - 通过 Python 在 Linux 上的进程列表

python - 如何在python中的线程循环中引发异常?

python - Pyperclip 复制导致操作系统错误

Python 3.5 Pyperclip 模块导入失败

python - 使用 Selenium 登录

python - 从Python中的句子中提取子句

python - Pyperclip 有最大字符数吗?