• 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

  • 相关阅读:
    职场小白手收藏篇:职场应聘的面试技巧
    ES6 从入门到精通 # 20:async 的用法
    刷题分享—常见的经典面试题二
    21 C++设计模式之访问者(Visitor)模式
    Docker部署Emqx并配置ssl支持微信小程序
    Elasticsearch实战(五)---高级搜索 Match/Match_phrase/Term/Must/should 组合使用
    IO和进程day08(消息队列、共享内存、信号灯集)
    论文阅读:Deep-Learning Super-Resolution Microscopy
    Nacos集群配置以及在springboot中使用
    VB6学习路线及知识点
  • 原文地址:https://blog.csdn.net/weixin_44737922/article/details/125907035