升级Python而不破坏主要应用程序

Pau*_*l H 6 upgrade python python3

我目前安装了 python 3.8。我还单独安装了 python 3.11,但默认python3别名指向 3.8:

\n
\xe2\x9e\x9c  ~ python3 --version\nPython 3.8.10\n\xe2\x9e\x9c  ~ python3.11 --version\nPython 3.11.1\n
Run Code Online (Sandbox Code Playgroud)\n

我想将系统范围内的默认别名升级到 3.11,因为我将 uLauncher 与 Todoist 插件一起使用,该插件使用 python 包todoist-api-python

\n

问题:最新版本的包至少需要 python 3.9,但至少在我的系统上,默认python3指向 3.8,这是行不通的。因此,每当我安装该软件包时,它都会安装旧版本,该版本使用旧的、已弃用的todoist API版本,并且不再起作用。

\n

没有办法告诉 uLauncher 使用已经安装的python3.11据我所知,

\n

所以我尝试使用此处描述的方法将python3别名切换为指向 3.11update-alternatives

\n

起初,当我看到python3 --version打印出来时,我很高兴3.11,但我很快意识到这实际上破坏了重大事情。uLauncher 应用程序(我尝试进行此 python 升级的原因)不再启动,甚至默认的 gnome 终端也不再启动。

\n

于是我又回到python3了3.8,以便能够正常使用我的电脑,但原来的问题仍然存在。

\n

我怀疑应用程序依赖于 python 并期望 3.8,因此当python3指向其他内容时它们会中断。

\n

如何在不破坏主要应用程序的情况下在 Ubuntu 20.04 上升级到 python 3.11?

\n

Raf*_*ffa 3

\n

如何在不破坏主要应用程序的情况下在 Ubuntu 20.04 上升级到 python 3.11?

\n
\n

不能...明白为什么吗?

\n

该怎么办?...创建一个python3.11虚拟环境...然后todoist-api-python像这样安装:

\n
ubuntu@Lenovo:~/test$ mkdir venv3_11 && cd venv3_11\nubuntu@Lenovo:~/test/venv3_11$ python3.11 -m venv env\nubuntu@Lenovo:~/test/venv3_11$ source env/bin/activate\n(env) ubuntu@Lenovo:~/test/venv3_11$ pip3 install todoist-api-python\nCollecting todoist-api-python\n  Using cached todoist_api_python-2.0.2-py3-none-any.whl (11 kB)\nCollecting attrs<23.0.0,>=22.0.0\n  Using cached attrs-22.2.0-py3-none-any.whl (60 kB)\nCollecting requests<3.0.0,>=2.26.0\n  Using cached requests-2.28.2-py3-none-any.whl (62 kB)\nCollecting urllib3<1.27,>=1.21.1\n  Downloading urllib3-1.26.14-py2.py3-none-any.whl (140 kB)\n     \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 140.6/140.6 KB 369.4 kB/s eta 0:00:00\nCollecting idna<4,>=2.5\n  Downloading idna-3.4-py3-none-any.whl (61 kB)\n     \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 61.5/61.5 KB 1.3 MB/s eta 0:00:00\nCollecting certifi>=2017.4.17\n  Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)\n     \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 155.3/155.3 KB 2.9 MB/s eta 0:00:00\nCollecting charset-normalizer<4,>=2\n  Downloading charset_normalizer-3.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (196 kB)\n     \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 196.8/196.8 KB 2.4 MB/s eta 0:00:00\nInstalling collected packages: charset-normalizer, urllib3, idna, certifi, attrs, requests, todoist-api-python\nSuccessfully installed attrs-22.2.0 certifi-2022.12.7 charset-normalizer-3.0.1 idna-3.4 requests-2.28.2 todoist-api-python-2.0.2 urllib3-1.26.14\n(env) ubuntu@Lenovo:~/test/venv3_11$ \n
Run Code Online (Sandbox Code Playgroud)\n

然后,从现在开始,要使用该包,您所需要做的就是激活该虚拟环境……虚拟环境中的 Python 安装包/模块并运行它们,就像系统范围的 Python 一样,但在安全的隔离环境中运行。

\n