• tensorflow 1.3.1 安装及报错解决


    按照以下顺序安装,注意这之前要装上cuda,并且tensorflow-gpu要最晚安装

    pip install cudatoolkit==10.0.130-0
    pip install cudnn=7.6.5
    pip install tensorflow-gpu==1.3.1
    
    • 1
    • 2
    • 3

    在import tensorflow as tf时遇到下列报错:

    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,选择版本为3.20.* 便可解决该问题
    pip install protobuf==3.20.*

    接下来再import TensorFlow,遇到下面问题
    D:\Anaconda3\envs\PY373\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
    _np_qint8 = np.dtype([(“qint8”, np.int8, 1)])
    D:\Anaconda3\envs\PY373\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
    _np_quint8 = np.dtype([(“quint8”, np.uint8, 1)])
    D:\Anaconda3\envs\PY373\lib\site-packages\tensorflow\python\framework\dtypes.py:528: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
    _np_qint16 = np.dtype([(“qint16”, np.int16, 1)])
    D:\Anaconda3\envs\PY373\lib\site-packages\tensorflow\python\framework\dtypes.py:529: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
    _np_quint16 = np.dtype([(“quint16”, np.uint16, 1)])
    D:\Anaconda3\envs\PY373\lib\site-packages\tensorflow\python\framework\dtypes.py:530: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
    _np_qint32 = np.dtype([(“qint32”, np.int32, 1)])
    D:\Anaconda3\envs\PY373\lib\site-packages\tensorflow\python\framework\dtypes.py:535: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
    np_resource = np.dtype([(“resource”, np.ubyte, 1)])

    给numpy降级即可解决
    pip install -U numpy==1.16.4

  • 相关阅读:
    作业-11.15
    强化学习-学习笔记14 | 策略梯度中的 Baseline
    Java Web概述
    新手怎样快速上手接口测试?掌握这几个知识点直接起飞!
    2. 设计模式-详解UML类图
    容器化 | 一文搞定镜像构建方式选型
    Thymeleaf常见属性
    c++随机数问题研究
    芯片洁净间的等级是如何划分的
    tailwindcss 一览表
  • 原文地址:https://blog.csdn.net/weixin_44737922/article/details/125907035