如何在ubuntu 16.04中将python版本从python2升级到python3

时间:2018-06-06 13:29:16

标签: python jupyter-notebook ubuntu-16.04

我有两个版本的python。我也单独安装了jupyter笔记本,当我打开jupyter笔记本并转到新版本时,它显示的是python 2

我想将python3用于更新的包。那么我们如何升级python版本。

2 个答案:

答案 0 :(得分:1)

如果内核在内核选项中不可见,则必须手动配置它。这就是我在macos上的表现。

# ...
data = x.read()

dates = re.findall('\d{4}[^+]*\+\d{4}', str(data))
dates = '\n'.join(dates)

saveFile = open('Ergebnis4.txt', 'w')
saveFile.write(dates)
saveFile.close()

运行这些命令后,您应该能够在change kernel选项中看到内核。

enter image description here

答案 1 :(得分:1)

更系统的方法是

1安装virtualenvwrapper

$ pip install virtualenvwrapper
$ export WORKON_HOME=~/Envs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv -p $(which python3) jupyter_notebook

2在此环境中安装jupyter

(jupyter_notebook)$ pip install jupyter

3运行笔记本

(jupyter_notebook)$ jupyter notebook

4要安装新软件包,请不要忘记激活新创建的虚拟环境

$ workon jupyter_notebook
(jupyter_notebook)$ pip install numpy