我正在尝试使用 Python 3.11 安装最新的 Tensorflow 模型 2.13.1 (pip install tf-models-official==2.13.1)。自上周以来,Cython 和 PyYAML 在 Tensorflow 模型 2.13.0 中似乎无法很好地协同工作,因此无法安装。
但是 2.13.1 给我一个错误,找不到相应的tensorflow-text版本2.13.0。 我收到的错误如下:
(tensorflow-env) username@DESKTOP:~/projects/tensorflow/models-master/research$ pip install tf-models-official==2.13.1
INFO: pip is looking at multiple versions of tf-models-official to determine which version is compatible with other requirements. This could take a while.
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11; 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10; 1.7.2 Requires-Python >=3.7,<3.11; 1.7.3 Requires-Python >=3.7,<3.11; 1.8.0 Requires-Python >=3.8,<3.11; 1.8.0rc1 Requires-Python >=3.8,<3.11; 1.8.0rc2 Requires-Python >=3.8,<3.11; 1.8.0rc3 Requires-Python >=3.8,<3.11; 1.8.0rc4 Requires-Python >=3.8,<3.11; 1.8.1 Requires-Python >=3.8,<3.11
ERROR: Could not find a version that satisfies the requirement tensorflow-text~=2.13.0 (from tf-models-official) (from versions: 2.12.0rc0, 2.12.0, 2.12.1, 2.13.0rc0)
ERROR: No matching distribution found for tensorflow-text~=2.13.0
但是 pypi.org 上的发布历史显示 2.13.0 版本的 tensorflow-text 已经发布:https://pypi.org/project/tensorflow-text/2.13.0/#history
我做错了什么?
我通过安装解决了这个问题
Python 3.10
Tensorflow 2.13.0
tensorflow-text 2.13.0
tensorflow-models-official 2.13.1
一切都适用于这些版本,但我没有找到使其适用于 Python 3.11 atm 的方法。
这个问题在这里得到了最好的描述(https://github.com/yaml/pyyaml/issues/724)并且与 Cython 和 PyYAML 5.4 依赖问题有关。
在 Windows 上遇到同样的错误。看起来
tensorflow-text
在 pypi 上不可用(自 2022 年起 Windows 不再有轮子)。
我还需要安装
tf-models-official
来进行图像实例分割。
既然 tensorflow-text
是一个用于文本相关处理操作(用于 NLP)的 TensorFlow 库,那么它真的需要吗?
我们可以手动修改 tf-models-official
包来删除 tensorflow-text
依赖吗?