【问题标题】:Tensorflow import error, cannot import the module pywrap_tensorflow from partially initialize moduleTensorFlow 导入错误,无法从部分初始化模块导入模块 pywrap_tensorflow
【发布时间】:2020-10-03 20:50:57
【问题描述】:

我开始使用 Tensorflow 进行机器学习,但是当我安装并尝试导入它时。 我看到了类似的问题并解决了它,我需要退出安装 tensorflow 的目录,但我尝试转到 C:/ 并在我做我的项目时转到一个目录,但它不起作用。

错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Felipe Garcia\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\Felipe Garcia\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
ImportError: cannot import name 'pywrap_tensorflow' from partially initialized module 'tensorflow.python' (most likely due to a circular import) (C:\Users\Felipe Garcia\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\__init__.py)

谢谢大家

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    按照这些步骤通过创建虚拟环境来安装 Tensorflow

    python -m venv --system-site-packages .\venv
    .\venv\Scripts\activate
    pip install --upgrade pip
    pip install --upgrade tensorflow
    #Verify the install:
    python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
    

    【讨论】:

      猜你喜欢
      • 2020-11-21
      • 2022-10-02
      • 2021-07-07
      • 2020-07-21
      • 1970-01-01
      • 1970-01-01
      • 2021-04-03
      • 2021-12-12
      • 1970-01-01
      相关资源
      最近更新 更多