在Python运行ipython notebook时发生了文件“<stdin>”,第1行语法错误:无效语法

2024-09-29 21:20:24 发布

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

我在maxos中安装了tensorflow+python,参考了一些关于web的资源。 环境pameters:Mac操作系统10.12+python2.7+tensorflow 0.5.0 当我试图打开笔记本时,我发生了这样的错误:

****MacBook:code ****$ python

Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 26 2016, 12:10:39) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ipython notebook
File "<stdin>", line 1
ipython notebook
               ^
SyntaxError: invalid syntax
>>> print  ‘hello'


python[notebook])

当我检查该条款时,结果是:

^{pr2}$

当我使用print命令时,结果是:

>>> print "hello"
    hello
>>> print(hello)
  Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
 NameError: name 'hello' is not defined
 >>> print("hello")
 hello

我找不到解决办法,你能给我一些有用的指导吗,非常感谢。在


Tags: webhello环境mactensorflowipythonstdinline

热门问题