错误解决:ModuleNotFoundError: No module named 'keras_contrib'

本人所使用环境:

tensorflow 2.3.1

keras 2.4.3

python 3.6

今天整理了一下电脑中的虚拟环境,在安装 "keras_contrib" 总是出错,特此写下三种解决方法:

1、pip install keras_contrib

方法 1 可能会报错:

ERROR: Could not find a version that satisfies the requirement keras_contrib (from versions: none)
ERROR: No matching distribution found for keras_contrib

那么请看方法 2: 直接从 github 中进行下载。

pip install git+https://www.github.com/keras-team/keras-contrib.git

此方法是网上最普遍的方法,但可能因为服务器的原因,一直报如下错误:

ERROR: Command errored out with exit status 128:

那么请看方法 3: 将方法 2 中的 https 换成 git!

pip install git+git://www.github.com/keras-team/keras-contrib.git

此方法在我的环境下成功执行!