如何在虚拟机中将 python3.5 升级为 python3.6?

how to upgrade python3.5 to python3.6 in Virtual Machine?

我有一个虚拟机 (Azure):

vm:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial

它是用 Python 3.5.6 安装的,我想将它升级到 3.6 以与某些库兼容。我尝试了以下方法:

vm:~$ python --version
Python 3.5.6 :: Anaconda, Inc.
vm:~$ sudo apt-get install python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'
vm:~$ sudo apt-get upgrade python3.6
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'

我可以知道怎么做吗?

我也可以从 JupyterLab 开始吗?

这里有一个建议:

关注这个https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get/865569#865569

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install python3.6

如果更新有问题,请检查此https://www.xmodulo.com/how-to-fix-apt-get-update-error-on-ubuntu.html#:~:text=This%20error%20can%20happen%20when,%22%20apt%2Dget%20update%20%22

$ sudo rm -rf /var/lib/apt/lists/*
$ sudo apt-get update
$ sudo apt-get upgrade python3.6

之后,在 JupyterLab (OS: Ubuntu 16.04 xenial)

升级点数:

!pip install --upgrade pip

安装虚拟环境:

!pip install virtualenv

用Python3创建新内核.6:

!virtualenv -p python3.6 Python_3_6

新建内核选项:

!python -m ipykernel install --user --name=Python_3_6

这将在启动新笔记本时在菜单中创建一个名为 Python_3_6 的新内核选项。现在这个新内核将与 运行 您需要的那些库兼容!