我开始使用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)
感谢所有人
答案 0 :(得分:0)
按照以下步骤创建虚拟环境安装 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])))"