简体   繁体   English

使用 Python 3 打开 Jupyter Notebook

[英]Open a Jupyter Notebook with Python 3

I am running Python2 on a Jupyter Notebook.我在 Jupyter Notebook 上运行 Python2。

When I try to do:当我尝试做:

import emcee

I get the error:我收到错误:

File "/home/me/.local/lib/python2.7/site-packages/emcee/ensemble.py", line 84
    parameter_names: Optional[Union[Dict[str, int], List[str]]] = None,
                   ^
SyntaxError: invalid syntax

Is this because I am using Python2 and should be running Python3?这是因为我使用的是 Python2 并且应该运行 Python3 吗?

If I do python -V and python3 -V in my terminal, I get Python 2.7.17 and Python 3.6.9 respectively.如果我在终端中执行python -Vpython3 -V ,我将分别获得Python 2.7.17Python 3.6.9

So is there an easy way to open a python 3 Jupyter Notebook?那么有没有一种简单的方法来打开一个python 3 Jupyter Notebook? I am running Ubuntu 18.04 LTS.我正在运行 Ubuntu 18.04 LTS。


When I search for answers, I see solutions that involve installing anaconda - but I already have both Jupyter Notebook and Python 3 on my machine.当我搜索答案时,我看到了涉及安装 anaconda 的解决方案 - 但我的机器上已经有 Jupyter Notebook 和 Python 3。 I don't want to mess things up by installing further versions of python and Jupyter Notebook if I don't need to.如果我不需要,我不想通过安装更多版本的 python 和 Jupyter Notebook 来搞砸。

Try simply typing in Jupyter notebook directly into your terminal without changing your location within the terminal.尝试直接在终端中输入 Jupyter notebook,而无需更改您在终端中的位置。 It may help to open a fresh terminal session and typing: jupyter notebook.打开一个新的终端会话并输入:jupyter notebook 可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM