macos下pip安装失败问题解决办法

问题描述

使用pip安装第三方库时,报错:

(chatglm) L4EX:ChatGLM-6B-main apple$ pip3 install transformers==4.27.1
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography import x509
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
ERROR: Could not find a version that satisfies the requirement transformers==4.27.1 (from versions: 0.1, 2.0.0,2.1.0, 2.1.1, 2.2.0, 2.2.1, 2.2.2, 2.3.0)
ERROR: No matching distribution found for transformers==4.27.1

原因分析

首先我在anaconda下创建了一个新的环境,问题是在这个新环境中安装第三方库时出现的。
网上查的资料说,如果Python的路径是python3的话就不会出问题。我查看了python的版本:

python -V

返回的是3.10.9 版本没问题。再查看位置

which python

返回的是**/Users/apple/opt/anaconda3/bin/python**
网上的资料在这里往往会显示usr/local下的路径,所以我感觉可能是因为python多版本的问题,然后进一步查找了pip的路径,发现pip和pip3都在**/usr/local/bin/**下。最终在pip install加上python3 -m解决问题。

解决方案

python3 -m pip install transformers==4.27.1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值