我正在尝试使用 vscode 中的 jupyter 笔记本创建一个运行 tensorflow 和 tf2onnx 的隔离虚拟环境。
tf2onnx packge 建议使用 python 3.7,而我的本地 3.7.9 版本通常可以很好地与 TensorFlow 项目配合使用,因此我使用 pyenv 将本地和全局版本设置为 3.7.9。
以下是我的设置过程:
python -m venv .venv
然后在 vscode 中启动新终端后:
pip install tensorflow==2.7.0
pip freeze > requirements.txt
之后,在我的 jupyter 笔记本的单元格中,以下行失败
import tensorflow.keras as keras
Run Code Online (Sandbox Code Playgroud)
例外:
Run Code Online (Sandbox Code Playgroud)TypeError: Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your …