安装tensorflow_text的方法
[注意]
tensorflow_text在2.4.0版本之前仅支持Linux和Mac,不支持Windos,2.4.0版本开始才支持Windos,且仅支持python3.6与3.7版本,不满足上述条件会报错。
tensorfow-cpu版本安装
pip install tensorflow_text #安装的text版本号必须与当前安装的tensorflow-cpu版本号一致,若之前没有安装tensorflow,该命令会自动安装tensorflow-cpu版本
tensorflow-gpu版本安装
注意:如果之前使用的是tensorflow-gpu版本,则使用
pip install tensorflow_text
会自动默认为之前没有安装tensorflow,因此会同时安装tensorflow-cpu版本和tensorflow_text从而导致tensorflow-gpu版本失效
解决方法
1、(如若已安装tensorflow-gpu版本,先将其卸载)
2、使用
pip install tensorflow_text
安装tensorflow_text
3、卸载tensorflow-cpu版本,具体包括:
pip uninstall tensorflow
pip uninstall tensorflow-estimator
pip uninstall tensorboard
pip uninstall tensorboard-plugin-wit
4、最后安装tensorflow-gpu版本
pip install tensorflow-gpu==xxx #xxx的版本号必须与tensorflow_text一致
补充
若使用pip单独安装某个包报以下错误:
即:
ERROR: After October 2020 you may experience errors
when installing or updating packages. This is
because pip will change the way that it resolves
dependency conflicts. We recommend you use
--use-feature=2020-resolver to test your packages
with the new resolver before it becomes the default.
解决方法:
在安装是加入--use-feature=2020-resolver
命令即可
pip install xxx #原安装命令
pip install xxx --use-feature=2020-resolver #解决报错