使用pip安装安装tensorflow时出错

2024-06-16 12:27:42 发布

您现在位置:Python中文网/ 问答频道 /正文

我在cmd:pip install tensorflow==2.1.0--user上写过 它正确地加载了所有包,但最后它说:

WARNING: The scripts estimator_ckpt_converter.exe, saved_model_cli.exe, tensorboard.exe, tf_upgrade_v2.exe, tflite_convert.exe, toco.exe and toco_from_protos.exe are installed in 'C:\Users\franc\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.

然后:

Successfully installed gast-0.2.2 tensorflow-2.1.0 tensorflow-estimator-2.1.0``

不管怎样,如果我写了一个代码,然后我尝试使用tensorflow,它就不起作用了

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

我得到的错误是:

Using TensorFlow backend.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):

File "c:\users\franc\appdata\local\programs\python\python37\lib\site-packages\tensorflow_core\__init__.py", line 42, in <module>
        from . _api.v2 import audio
    ImportError: cannot import name 'audio' from 'tensorflow_core._api.v2' (C:\Users\franc\AppData\Roaming\Python\Python37\site-packages\tensorflow_core\_api\v2\__init__.py)

Tags: installedinfromcoreimportapitftensorflow