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

无法安装指定版本Python求助:执行sudo apt-get install python>=3.6.6获3.5.3

Fixing the "apt-get installs Python 3.5.3 instead of 3.6.6+" Issue

Hey there! I’ve dealt with this exact problem a few times, so let me walk you through what’s going wrong and how to fix it.

Why this happens

The apt-get tool doesn’t support version range syntax like >=3.6.6—when you run sudo apt-get install python>=3.6.6, it just looks for the package named python in your system’s repositories. On older Debian/Ubuntu releases, this package is typically mapped to Python 3.5.x, which is why you’re ending up with 3.5.3 instead of the version you want.

How to install Python 3.6.6+ correctly

Here are the steps to get the right version installed:

  1. Check available versions in your default repos
    First, update your package list to make sure you have the latest info:

    sudo apt update
    

    Then, see if Python 3.6+ is available directly by running:

    apt list python3.*
    

    If you see python3.6 (or higher) in the list, install it with:

    sudo apt-get install python3.6
    

    Replace 3.6 with the specific version you need (like 3.7, 3.8, etc.) if it’s available.

  2. Add a third-party repo if needed
    If your default repos don’t have Python 3.6+, the deadsnakes PPA is a reliable source for newer Python versions. Here’s how to use it:

    • Install the required tools to add PPAs:
      sudo apt install software-properties-common
      
    • Add the deadsnakes repo:
      sudo add-apt-repository ppa:deadsnakes/ppa
      
    • Update your package list again:
      sudo apt update
      
    • Now install your desired Python version:
      sudo apt install python3.6
      
  3. Set the default Python version (optional)
    If you want to make the newly installed Python the default python3 on your system, use update-alternatives:

    • Register the installed versions with alternatives:
      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 the default version by running:
      sudo update-alternatives --config python3
      

    Just follow the on-screen prompt to pick the number corresponding to Python 3.6.

That should get you the Python version you need! Let me know if you run into any snags along the way.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.07 17:08:03