为什么仅在使用Python3.5的Jupyter笔记本中,使用async def给出SyntaxError:invalid语法?
我有一个virtualenv,它只使用python 3.5进行设置。当我在那个环境里为什么仅在使用Python3.5的Jupyter笔记本中,使用async def给出SyntaxError:invalid语法?,python,jupyter,Python,Jupyter,我有一个virtualenv,它只使用python 3.5进行设置。当我在那个环境里 $python --version #gives python 3.5.1 $python # in the interpreter. >>>async def func():pass >>>func() 很好用。 我正在开发linux操作系统 $ipython --version gives 4.0.1 $ipython ln [1]: async def fun
$python --version #gives python 3.5.1
$python # in the interpreter.
>>>async def func():pass
>>>func()
很好用。
我正在开发linux操作系统
$ipython --version gives 4.0.1
$ipython
ln [1]: async def func():pass
ln [2]: func() # gives <coroutine object func at 0x7f57524b59e8>
我已经仔细检查了所有的间距。当我使用
!which python
它指向了在virtualenv终端上运行interperter时使用的同一个文件。在下面与Padric Cunningham交换后,我尝试了Anaconda,发现了相同的问题。 我清除了我的系统中与jupyter有关的任何东西。我清理了我的.bashrc、.pythonstartup.py和.profile文件,其中包括对$PATH和$PYTHONPATH的更改 我相信问题在于: .local/share/jupyter/kernels/python3 我还删除了我的主目录中的一个.jupyter文件,该文件似乎是一个遗留文件,以及Padric提到的文件: /usr/local/share/jupyter/kernels/python3通过其jupyter文件夹删除
清理后,我重新安装了Anaconda和jupyter笔记本。Jupyter笔记本现在可以在anaconda虚拟环境中与python 3.5.1配合使用 你确定你在jupyter中使用python3.5?我已经使用了!那是什么陈述。到env-bin/python。如果有更好的检查方法,我不知道。有什么建议吗?我是笔记本中的一个3内核,在该环境中我唯一拥有的python是Python3.5.1您是如何指定要使用哪个解释器的?当我构建环境时,我指定了它。virtualenv-p python3.5 jupyterenv3.5。当我在终端中激活它时,终端显示python 3.5作为版本,并且在激活的终端中运行的解释器显示3.5;系统版本输出?
!which python