jupyter运行时报错

AttributeError Traceback (most recent call last)
Cell In[1], line 3
1 # 该包提供类似关系型数据库(Oracle)中以表格形式处理数据的功能,更加灵活
2 import pandas as pd
----> 3 import tensorflow as tf
4 import numpy as np
5 import datetime as dt

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow_init_.py:41
38 import six as _six
39 import sys as _sys
---> 41 from tensorflow.python.tools import module_util as _module_util
42 from tensorflow.python.util.lazy_loader import LazyLoader as _LazyLoader
44 # Make sure code inside the TensorFlow codebase can use tf2.enabled() at import.

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python_init_.py:45
40 from tensorflow.python.eager import context
42 # pylint: enable=wildcard-import
43
44 # Bring in subpackages.
---> 45 from tensorflow.python import data
46 from tensorflow.python import distribute
47 from tensorflow.python import keras

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data_init_.py:25
22 from future import print_function
24 # pylint: disable=unused-import
---> 25 from tensorflow.python.data import experimental
26 from tensorflow.python.data.ops.dataset_ops import Dataset
27 from tensorflow.python.data.ops.dataset_ops import INFINITE as INFINITE_CARDINALITY

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data\experimental_init_.py:96
93 from future import print_function
95 # pylint: disable=unused-import
---> 96 from tensorflow.python.data.experimental import service
97 from tensorflow.python.data.experimental.ops.batching import dense_to_ragged_batch
98 from tensorflow.python.data.experimental.ops.batching import dense_to_sparse_batch

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data\experimental\service_init_.py:21
18 from future import division
19 from future import print_function
---> 21 from tensorflow.python.data.experimental.ops.data_service_ops import distribute
22 from tensorflow.python.data.experimental.service.server_lib import DispatchServer
23 from tensorflow.python.data.experimental.service.server_lib import WorkerServer

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data\experimental\ops\data_service_ops.py:25
22 import six
24 from tensorflow.python import tf2
---> 25 from tensorflow.python.data.experimental.ops import compression_ops
26 from tensorflow.python.data.experimental.ops.distribute_options import AutoShardPolicy
27 from tensorflow.python.data.experimental.ops.distribute_options import ExternalStatePolicy

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data\experimental\ops\compression_ops.py:20
17 from future import division
18 from future import print_function
---> 20 from tensorflow.python.data.util import structure
21 from tensorflow.python.ops import gen_experimental_dataset_ops as ged_ops
24 def compress(element):

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data\util\structure.py:26
23 import six
24 import wrapt
---> 26 from tensorflow.python.data.util import nest
27 from tensorflow.python.framework import composite_tensor
28 from tensorflow.python.framework import ops

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\data\util\nest.py:41
38 import six as _six
40 from tensorflow.python import _pywrap_utils
---> 41 from tensorflow.python.framework import sparse_tensor as _sparse_tensor
42 from tensorflow.python.util.compat import collections_abc as _collections_abc
45 def sorted(dict):

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\framework\sparse_tensor.py:29
27 from tensorflow.python import tf2
28 from tensorflow.python.framework import composite_tensor
---> 29 from tensorflow.python.framework import constant_op
30 from tensorflow.python.framework import dtypes
31 from tensorflow.python.framework import ops

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\framework\constant_op.py:29
27 from tensorflow.core.framework import types_pb2
28 from tensorflow.python.eager import context
---> 29 from tensorflow.python.eager import execute
30 from tensorflow.python.framework import dtypes
31 from tensorflow.python.framework import op_callbacks

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\eager\execute.py:27
25 from tensorflow.python import pywrap_tfe
26 from tensorflow.python.eager import core
---> 27 from tensorflow.python.framework import dtypes
28 from tensorflow.python.framework import ops
29 from tensorflow.python.framework import tensor_shape

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\tensorflow\python\framework\dtypes.py:513
482 _NP_TO_TF[pdt] = next(
483 _NP_TO_TF[dt] for dt in _NP_TO_TF if dt == pdt().dtype)
486 TF_VALUE_DTYPES = set(_NP_TO_TF.values())
489 _TF_TO_NP = {
490 types_pb2.DT_HALF:
491 np.float16,
492 types_pb2.DT_FLOAT:
493 np.float32,
494 types_pb2.DT_DOUBLE:
495 np.float64,
496 types_pb2.DT_INT32:
497 np.int32,
498 types_pb2.DT_UINT8:
499 np.uint8,
500 types_pb2.DT_UINT16:
501 np.uint16,
502 types_pb2.DT_UINT32:
503 np.uint32,
504 types_pb2.DT_UINT64:
505 np.uint64,
506 types_pb2.DT_INT16:
507 np.int16,
508 types_pb2.DT_INT8:
509 np.int8,
510 # NOTE(touts): For strings we use np.object as it supports variable length
511 # strings.
512 types_pb2.DT_STRING:
--> 513 np.object,
514 types_pb2.DT_COMPLEX64:
515 np.complex64,
516 types_pb2.DT_COMPLEX128:
517 np.complex128,
518 types_pb2.DT_INT64:
519 np.int64,
520 types_pb2.DT_BOOL:
521 np.bool,
522 types_pb2.DT_QINT8:
523 _np_qint8,
524 types_pb2.DT_QUINT8:
525 _np_quint8,
526 types_pb2.DT_QINT16:
527 _np_qint16,
528 types_pb2.DT_QUINT16:
529 _np_quint16,
530 types_pb2.DT_QINT32:
531 _np_qint32,
532 types_pb2.DT_BFLOAT16:
533 _np_bfloat16,
534
535 # Ref types
536 types_pb2.DT_HALF_REF:
537 np.float16,
538 types_pb2.DT_FLOAT_REF:
539 np.float32,
540 types_pb2.DT_DOUBLE_REF:
541 np.float64,
542 types_pb2.DT_INT32_REF:
543 np.int32,
544 types_pb2.DT_UINT32_REF:
545 np.uint32,
546 types_pb2.DT_UINT8_REF:
547 np.uint8,
548 types_pb2.DT_UINT16_REF:
549 np.uint16,
550 types_pb2.DT_INT16_REF:
551 np.int16,
552 types_pb2.DT_INT8_REF:
553 np.int8,
554 types_pb2.DT_STRING_REF:
555 np.object,
556 types_pb2.DT_COMPLEX64_REF:
557 np.complex64,
558 types_pb2.DT_COMPLEX128_REF:
559 np.complex128,
560 types_pb2.DT_INT64_REF:
561 np.int64,
562 types_pb2.DT_UINT64_REF:
563 np.uint64,
564 types_pb2.DT_BOOL_REF:
565 np.bool,
566 types_pb2.DT_QINT8_REF:
567 _np_qint8,
568 types_pb2.DT_QUINT8_REF:
569 _np_quint8,
570 types_pb2.DT_QINT16_REF:
571 _np_qint16,
572 types_pb2.DT_QUINT16_REF:
573 _np_quint16,
574 types_pb2.DT_QINT32_REF:
575 _np_qint32,
576 types_pb2.DT_BFLOAT16_REF:
577 _np_bfloat16,
578 }
580 _QUANTIZED_DTYPES_NO_REF = frozenset([qint8, quint8, qint16, quint16, qint32])
581 _QUANTIZED_DTYPES_REF = frozenset(
582 [qint8_ref, quint8_ref, qint16_ref, quint16_ref, qint32_ref])

File D:\ANACONDA\envs\tensorflow2\lib\site-packages\numpy_init_.py:305, in getattr(attr)
300 warnings.warn(
301 f"In the future np.{attr} will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in former_attrs:
--> 305 raise AttributeError(former_attrs[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full numpy.testing namespace
313 if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'object'.
np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

不要用np.object,直接用object就可以