如何阻止我的终端默认使用旧的Python 2.7.10来安装Pyperclip?

时间:2019-06-20 22:44:43

标签: python pip

我正在尝试将PyperclipPip一起安装,但是我收到一条警告,说“ Python 2.7将于2020年1月1日到期。”并告诉我升级。之后,我在安装过程中遇到了很多错误。

我的系统上安装了Python 2.7.10和3.7.3。

启动pip install pyperclip时出现错误:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pyperclip
  Using cached https://files.pythonhosted.org/packages/2d/0f/4eda562dffd085945d57c2d9a5da745cfb5228c02bc90f2c74bbac746243/pyperclip-1.7.0.tar.gz
Installing collected packages: pyperclip
  Running setup.py install for pyperclip ... error
    ERROR: Complete output from command /usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/b5/yshbmh_d1352tytvt1r95hwr0000gn/T/pip-install-EKTm69/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 /private/var/folders/b5/yshbmh_d1352tytvt1r95hwr0000gn/T/pip-record-ntOrdw/install-record.txt --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/pyperclip
    copying src/pyperclip/__init__.py -> build/lib/pyperclip
    copying src/pyperclip/__main__.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
    ----------------------------------------
ERROR: Command "/usr/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/b5/yshbmh_d1352tytvt1r95hwr0000gn/T/pip-install-EKTm69/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 /private/var/folders/b5/yshbmh_d1352tytvt1r95hwr0000gn/T/pip-record-ntOrdw/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b5/yshbmh_d1352tytvt1r95hwr0000gn/T/pip-install-EKTm69/pyperclip/

我希望Pyperclip能够正确安装。

2 个答案:

答案 0 :(得分:0)

const data = "Raúl, Moreno. Rodríguez Carlos";
const result = data.match(/\b[A-Z]/gm);
console.log(result);

enter image description here

答案 1 :(得分:0)

您可能需要致电pip3而不是pip