watch: TF2 - PKU 00 | Environment Setup

Table of contents

【北京大学】Tensorflow2.0 - bilibili

创建环境

1
2
3
4
conda create -n tf2.1 python=3.7
conda install -c conda-forge cudatoolkit=10.1 cudnn=7.6
pip install --upgrade pip
pip install tensorflow==2.1

导入失败,报错:

1
2
3
4
5
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 protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

查看protobuf 版本:pip show protobuf

1
2
pip uninstall protobuf
pip install protobuf==3.19.0

StackOverflow ans

Built with Hugo
Theme Stack designed by Jimmy