怎么办_怎么做_How to do anything_解决问题万事OK

TypeError: expected bytes, Descriptor found解决办法?

py3.6运行程序出现如下错误:
     __module__ = 'google.protobuf.descriptor_pb2'
    TypeError: expected bytes, Descriptor found

 

分析:

从__module__ = 'google.protobuf.descriptor_pb2'可以看出,错误是protobuf的问题。

本环境是python3,所以怀疑是1.protobuf版本过低,2.protobuf支持py2,需要装py3。所以:

    pip install protobuf-py3
    pip install --upgrade protobuf

 

重新运行,发现错误变化,说明上一个问题已解决,下一个环境有问题。。。(吐血)

    >>> import tensorflow
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
        from tensorflow.python import *
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\tensorflow\python\__init__.py", line 77, in <module>
        from tensorflow.python.estimator import estimator_lib as estimator
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\tensorflow\python\estimator\estimator_lib.py", line 24, in <module>
        from tensorflow.python.estimator.inputs import inputs
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\tensorflow\python\estimator\inputs\inputs.py", line 23, in <module>
        from tensorflow.python.estimator.inputs.pandas_io import pandas_input_fn
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\tensorflow\python\estimator\inputs\pandas_io.py", line 28, in <module>
        import pandas as pd
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\pandas\__init__.py", line 30, in <module>
        from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\pandas\_libs\__init__.py", line 3, in <module>
        from .tslibs import (
      File "C:\Users\HIT\Anaconda3\envs\sgan\lib\site-packages\pandas\_libs\tslibs\__init__.py", line 3, in <module>
        from .conversion import localize_pydatetime, normalize_date
      File "pandas/_libs/tslibs/conversion.pyx", line 234, in init pandas._libs.tslibs.conversion
    AttributeError: type object 'pandas._libs.tslibs.conversion._TSObject' has no attribute '__reduce_cython__'

 

查博客,查到:

pip install  pandas==0.23.0

 

再次重新检查

    >>> import tensorflow
    >>> hello = tensorflow.constant('helllllllllo')
    >>> sess = tf.session()
    >>> sess = tensorflow.Session()
    >>> print(sess.run(hello))
    b'helllllllllo'

 
【关键字】:

此文由 yeaso   万事OK网编辑:首页 > IT » TypeError: expected bytes, Descriptor found解决办法?

相关推荐

© 2020 怎么办_怎么做_How to do anything_解决问题万事OK  京ICP备13039979号-5