You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Ubuntu 16.04虚拟机中升级Python3.5至Python3.6的方法及JupyterLab可行性咨询

Upgrade Python 3.5 to 3.6 on Ubuntu 16.04 LTS (Azure VM)

Hey there! Let's fix that "unable to locate package" error and get Python 3.6 set up on your VM, plus cover how to handle this with JupyterLab:

Why apt-get can't find Python 3.6?

Ubuntu 16.04's default software repositories don't include Python 3.6 out of the box. You'll need to add a trusted third-party PPA (Personal Package Archive) that hosts older/newer Python versions—deadsnakes is the standard choice for this.

Method 1: System-wide install via APT

Follow these steps to get Python 3.6 working with apt:

  1. Add the deadsnakes PPA to your system:
    sudo add-apt-repository ppa:deadsnakes/ppa
    
    Press Enter when prompted to confirm adding the repository.
  2. Update your package lists to pull in the new PPA's contents:
    sudo apt-get update
    
  3. Install Python 3.6:
    sudo apt-get install python3.6
    
    This should resolve the package not found error now.

Optional: Set Python 3.6 as default python3

If you want python3 to point to 3.6 instead of the original 3.5, use the update-alternatives tool:

# Register both versions with priority levels
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2

# Select which version to use by default
sudo update-alternatives --config python3

Just enter the number corresponding to Python 3.6 when prompted, and you're done.

Since your current Python is from Anaconda, creating a dedicated environment with Python 3.6 is safer (it won't mess with your system's default Python):

  1. Create a new conda environment with Python 3.6:
    conda create -n py36 python=3.6
    
  2. Activate the environment to start using Python 3.6:
    source activate py36
    
    Now running python --version will show Python 3.6 in this environment.

Can you do this via JupyterLab?

Absolutely! Here's how to add your Python 3.6 environment as a Jupyter kernel:

For conda environments:

  1. Activate your py36 environment first:
    source activate py36
    
  2. Install the ipykernel package to connect the environment to Jupyter:
    conda install ipykernel
    
  3. Register the environment as a Jupyter kernel:
    python -m ipykernel install --user --name py36 --display-name "Python 3.6 (py36)"
    
  4. Restart JupyterLab, and you'll see the "Python 3.6 (py36)" option in the kernel launcher.

For APT-installed Python 3.6:

  1. Install required tools for kernel setup:
    sudo apt-get install python3.6-dev python3.6-pip
    pip3.6 install ipykernel
    
  2. Register the kernel:
    python3.6 -m ipykernel install --user --name python36 --display-name "Python 3.6"
    
    Restart JupyterLab, and the new kernel will be available.

内容的提问来源于stack exchange,提问作者blackraven

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 21:59:07