Mac pip安装allennlp

pip

我的环境:

  • Python:3.8
  • torch:1.9
pip install allennlp==2.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

如果你的torch是1.8,那么对应的allennlp版本是2.4、2.5,别问我怎么知道的,我试出来的…官网也没找到对应版本的信息

git链接:

https://github.com/allenai/allennlp

我出现的问题:

module ‘lib’ has no attribute ‘X509_V_FLAG_CB_ISSUER_CHECK’

module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

升级版本即可:

pip uninstall pyOpenSSL
pip install pyOpenSSL

在这里插入图片描述

RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn’t match a supported version!

warnings.warn("urllib3 ({}) or chardet ({}) doesn’t match a supported "

from allennlp.modules.elmo import Elmo, batch_to_ids
import allennlp

print(allennlp.__version__)
RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
  warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "

在这里插入图片描述
这是版本不匹配导致的,先看下版本(虽然警告里已经给出了):

pip list | grep urllib3
pip list | grep chardet
urllib3                            1.26.12
chardet                            3.0.4

点警告信息(蓝色的),点进去如下图所示:

在这里插入图片描述

意思是:

  • urlllib3的版本范围是:≥1.21.1、≤1.25,警告提示的是1.26,超过这个范围了,需要降一下;
  • chardet的版本范围是:≥3.0.2、<3.1,警告中的是3.0.4,在这个范围内,不用动;
pip install urllib3==1.25

到这就OK了,docker安装后面再补

猜你喜欢

转载自blog.csdn.net/qq_42363032/article/details/127222333