简体   繁体   English

无法安装 pip,因为我的 Mac 默认有 python 2.7

[英]Unable to install pip because my Mac has python 2.7 by default

I'm currently trying to download pip onto my python 3.9.6 I had downloaded off the official website, but my Macbook (version 10.15.6 Catalina) returns the line:我目前正在尝试将 pip 下载到我从官方网站下载的 python 3.9.6 上,但我的 Macbook(版本 10.15.6 Catalina)返回了该行:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py
ERROR: This script does not work on Python 2.7 The minimum supported Python version is 3.6. Please use https://bootstrap.pypa.io/pip/2.7/get-pip.py instead.

So I then tried installing python3 using the post Getting an error installing pip in my Mac which said to run the line:所以我然后尝试使用帖子在我的 Mac 中安装 pip 时出错,它说要运行以下行:

$ python3 --version
Python 3.7.0

which installed python3 for me, and running $ python3 --version afterwards shows that I have Python 3.8.2 installed now.它为我安装了 python3,然后运行 ​​$ python3 --version 显示我现在安装了 Python 3.8.2。 Yet then running the line returns that I can't install the packages due to:然而,然后运行该行返回我无法安装软件包,因为:

$ pip3 install --upgrade pip Collecting pip
  Using cached https://files.pythonhosted.org/packages/47/ca/f0d790b6e18b3a6f3bd5e80c2ee4edbb5807286c21cdd0862ca933f751dd/pip-21.1.3-py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'RECORD'
Consider using the `--user` option or check the permissions.

WARNING: You are using pip version 19.2.3, however version 21.1.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Can anyone help me with this error?谁能帮我解决这个错误? My account is an admin account already so I'm confused by what it means by check the permissions.我的帐户已经是管理员帐户,所以我对检查权限的含义感到困惑。

You don't have permission to install packages globally.您无权全局安装软件包。 Either use Sudo, or install for the current user only, as suggested in the command output you posted.按照您发布的命令输出中的建议,使用 Sudo 或仅为当前用户安装。

sudo pip3 install <package>

or要么

pip3 install --user <package>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM