python - 收到错误:tensorflow 的语法无效
问题描述
在不同环境的 conda 中安装 tensorflow。
导入 tensorflow 时仍然出错。
Traceback (most recent call last):
File "C:\Users\HP\Anaconda3\envs\tensorflow_cpu\lib\site-packages\IPython\core\interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-64156d691fe5>", line 1, in <module>
import tensorflow as tf
File "C:\Users\HP\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\HP\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\HP\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\HP\Anaconda3\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 111
def TFE_ContextOptionsSetAsync(arg1, async):
^
SyntaxError: invalid syntax
请帮我怎么办我也改变了python的路径仍然存在问题。
解决方案
推荐阅读
- sql - 将列表达式的结果添加为表变量创建的新列
- c - 在 C 中解析主函数中的参数时出现意外结果
- typescript - 在 Typescript 中为单行禁止未使用的属性警告
- jenkins - 詹金斯多分支声明性管道中每个分支的不同参数
- c++ - GoogleTest:不同库中的 main() -> 未找到测试用例
- python - Django 要求在已经定义的情况下定义“模型”
- sql-server - SQL Server System.OutOfMemoryException + 太多结果
- intellij-idea - 重新格式化为单行
- jquery - 拖动元素并滚动到顶部使元素保持在其位置,但光标会改变位置
- r - RStudio EC2 上的 Sparklyr 调用错误 hadoopConfiguration 独立集群