我在Ubuntu上安装了Tensorflow。当我想测试Tensorflow时,出现了这个语法错误:
VirtualBox:~$ # PythonVirtualBox:~$ import tensorflow as tfVirtualBox:~$ hello = tf.constant('Hello, TensorFlow!')bash: syntax error near unexpected token `('
我在虚拟机上使用Ubuntu。我该如何修复这个错误?我想按照这个视频在Windows上安装Ubuntu:https://www.youtube.com/watch?v=YLX2pLg1rWw
回答:
你没有启动Python,而bash无法理解你的导入语句。输入python然后按回车(不是Python)。然后应该会出现一个类似>>>的提示符。现在运行import等语句。