1
0
Fork 0

沈浪熊猫儿:如何在Debian中更改默认的Python版本

This commit is contained in:
沈浪熊猫儿 2022-08-06 00:38:34 +08:00
parent 44fdff742d
commit 7ce8138262
2 changed files with 115 additions and 17 deletions

View File

@ -1,40 +1,42 @@
<TeXmacs|2.1.2> <TeXmacs|2.1.3>
<style|<tuple|generic|chinese>> <style|<tuple|generic|chinese>>
<\body> <\body>
<\hide-preamble> <\hide-preamble>
<assign|myspace|http://git.tmml.wiki/XmacsLabs/planet/raw/main/\<#6C88\>\<#6D6A\>\<#718A\>\<#732B\>\<#513F\>/> <assign|myspace|http://git.tmml.wiki/XmacsLabs/planet/raw/main/沈浪熊猫儿/>
<assign|gitlink|<macro|name|<hlink|<arg|name>|<merge|<value|myspace>|<arg|name>|.tm>>>> <assign|gitlink|<macro|name|<hlink|<arg|name>|<merge|<value|myspace>|<arg|name>|.tm>>>>
</hide-preamble> </hide-preamble>
<doc-data|<doc-title|\<#6C88\>\<#6D6A\>\<#718A\>\<#732B\>\<#513F\>\<#7684\>\<#7A7A\>\<#95F4\>>> <doc-data|<doc-title|沈浪熊猫儿的空间>>
\<#5927\>\<#5BB6\>\<#597D\>\<#FF0C\>\<#6211\>\<#662F\>Up\<#4E3B\>\<#6C88\>\<#6D6A\>\<#718A\>\<#732B\>\<#513F\><\footnote> 大家好我是Up主沈浪熊猫儿<\footnote>
<slink|https://space.bilibili.com/28058658> <slink|https://space.bilibili.com/28058658>
</footnote>\<#FF0C\>\<#6BD5\>\<#4E1A\>\<#4E8E\>\<#4E2D\>\<#56FD\>\<#79D1\>\<#5B66\>\<#6280\>\<#672F\>\<#5927\>\<#5B66\>\<#8BA1\>\<#7B97\>\<#673A\>\<#7CFB\>\<#FF0C\>\<#662F\>GNU </footnote>,毕业于中国科学技术大学计算机系,是GNU
<TeXmacs>\<#7684\>\<#5F00\>\<#53D1\>\<#8005\>\<#548C\>\<#58A8\>\<#5E72\>\<#7F16\>\<#8F91\>\<#5668\>\<#7684\>\<#4F5C\>\<#8005\>\<#3002\>\<#8BD1\>\<#6709\>\<#300A\>Scala\<#5B9E\>\<#7528\>\<#6307\>\<#5357\>\<#300B\>\<#FF0C\>\<#73B0\>\<#5B9E\>\<#751F\>\<#6D3B\>\<#4E2D\>\<#662F\>\<#4E00\>\<#540D\>\<#6570\>\<#636E\>\<#5DE5\>\<#7A0B\>\<#5E08\>\<#3002\> <TeXmacs>的开发者和墨干编辑器的作者。译有《Scala实用指南》现实生活中是一名数据工程师。
\<#6211\>\<#7684\>\<#7535\>\<#5B50\>\<#90AE\>\<#7BB1\>\<#662F\><verbatim|shenda 我的电子邮箱是<verbatim|shenda AT
AT ustc.edu>\<#FF0C\>\<#6B22\>\<#8FCE\>\<#5927\>\<#5BB6\>\<#53D1\>\<#90AE\>\<#4EF6\>\<#7ED9\>\<#6211\>\<#3002\> ustc.edu>,欢迎大家发邮件给我。
<section*|\<#6587\>\<#7AE0\>\<#5217\>\<#8868\>> <section*|文章列表>
<\itemize> <\itemize>
<item><gitlink|\<#5982\>\<#4F55\>\<#5B89\>\<#88C5\>Fandol\<#5B57\>\<#4F53\>> <item><gitlink|如何在Debian中更改默认的Python版本>
<item><gitlink|Git\<#65B0\>\<#7528\>\<#6237\>\<#5E38\>\<#7528\>\<#914D\>\<#7F6E\>> <item><gitlink|如何安装Fandol字体>
<item><gitlink|2021\<#5E74\>\<#6D59\>\<#6C5F\>\<#9AD8\>\<#8003\>\<#6570\>\<#5B66\>\<#7B2C\>\<#4E03\>\<#9898\>\<#51FD\>\<#6570\>\<#66F2\>\<#7EBF\>\<#7ED8\>\<#5236\>> <item><gitlink|Git新用户常用配置>
<item><gitlink|\<#5982\>\<#4F55\>\<#8F93\>\<#5165\>\<#5E0C\>\<#814A\>\<#5B57\>\<#6BCD\>> <item><gitlink|2021年浙江高考数学第七题函数曲线绘制>
<item><gitlink|Bash\<#811A\>\<#672C\>\<#57FA\>\<#7840\>> <item><gitlink|如何输入希腊字母>
<item><gitlink|\<#5B9A\>\<#5236\>\<#5FEB\>\<#6377\>\<#952E\>\<#5FEB\>\<#901F\>\<#8F93\>\<#5165\>\<#4EE5\>1\<#4E3A\>\<#5206\>\<#5B50\>\<#7684\>\<#5206\>\<#5F0F\>> <item><gitlink|Bash脚本基础>
<item><gitlink|<gitlink|>\<#4E3A\>\<#4EC0\>\<#4E48\>\<#8BF4\>Scala\<#662F\>JVM\<#4E0A\>\<#7684\>C++\<#FF1F\>> <item><gitlink|定制快捷键快速输入以1为分子的分式>
<item><gitlink|<gitlink|>为什么说Scala是JVM上的C++>
</itemize> </itemize>
</body> </body>
@ -55,7 +57,7 @@
<\auxiliary> <\auxiliary>
<\collection> <\collection>
<\associate|toc> <\associate|toc>
<vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|\<#6587\>\<#7AE0\>\<#5217\>\<#8868\>> <vspace*|1fn><with|font-series|<quote|bold>|math-font-series|<quote|bold>|文章列表>
<datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>> <datoms|<macro|x|<repeat|<arg|x>|<with|font-series|medium|<with|font-size|1|<space|0.2fn>.<space|0.2fn>>>>>|<htab|5mm>>
<no-break><pageref|auto-1><vspace|0.5fn> <no-break><pageref|auto-1><vspace|0.5fn>
</associate> </associate>

View File

@ -0,0 +1,96 @@
<TeXmacs|2.1.3>
<style|<tuple|generic|chinese>>
<\body>
<doc-data|<doc-title|如何在Debian中切换默认Python版本>>
首先查看当前系统中默认的Python版本
<\session|shell|default>
<\output>
Shell session inside TeXmacs pid = 1042144
</output>
<\unfolded-io|Shell] >
python --version
<|unfolded-io>
Python 3.7.7
</unfolded-io>
<\input|Shell] >
\;
</input>
</session>
然后查看当前系统可用的Python有哪些
<\session|shell|default>
<\unfolded-io|Shell] >
ls /usr/bin/python[0-9].*[0-9]
<|unfolded-io>
/usr/bin/python3.10 \ /usr/bin/python3.7 \ /usr/bin/python3.8
\ /usr/bin/python3.9
</unfolded-io>
<\input|Shell] >
\;
</input>
</session>
我们可以把以上的python版本都放入python命令的候补列表
<\shell-code>
sudo update-alternatives --install /usr/bin/python python
/usr/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python python
/usr/bin/python3.9 3
sudo update-alternatives --install /usr/bin/python python
/usr/bin/python3.10 4
</shell-code>
现在我们可以列出这个候补列表
<\session|shell|default>
<\unfolded-io|Shell] >
update-alternatives --list python
<|unfolded-io>
/usr/bin/python3.10
/usr/bin/python3.7
/usr/bin/python3.8
/usr/bin/python3.9
</unfolded-io>
<\unfolded-io|Shell] >
python --version
<|unfolded-io>
Python 3.10.5
</unfolded-io>
<\input|Shell] >
\;
</input>
</session>
现在默认的Python版本已经切换到Python
3.10.5,说明上面最后的数字越大,优先级越高。
我们也可以使用
<\shell-code>
<code|update-alternatives --config python>
</shell-code>
在终端中以交互模式选择我们的默认Python版本。
</body>
<\initial>
<\collection>
<associate|page-medium|paper>
</collection>
</initial>