[Newbies] python
Tofloor
poster avatar
匠人
deepin
2022-04-18 05:15
Author

今天安装了python3,如何将python2卸载掉?

Reply Favorite View the author
All Replies
whoam1
deepin
2022-04-18 05:25
#1

系统内置的python不要卸载或升级操作,系统内置的某些软件或服务依赖于此环境

Reply View the author
yjmthu
deepin
2022-04-18 19:28
#2

把默认的python改成Python3即可,卸载系统自带的python会产生各种问题。

Reply View the author
匠人
deepin
2022-04-19 05:12
#3
whoam1

系统内置的python不要卸载或升级操作,系统内置的某些软件或服务依赖于此环境

感谢解答!

Reply View the author
匠人
deepin
2022-04-19 05:12
#4
yjmthu

把默认的python改成Python3即可,卸载系统自带的python会产生各种问题。

感谢解答,如何更改默认的是python3?

Reply View the author
yjmthu
deepin
2022-04-20 00:13
#5
匠人

感谢解答,如何更改默认的是python3?

两行命令

  1. 删除现有的python2的软链接 sudo rm /usr/bin/python
  2. 建立新的软链接,python3.X 具体是多少看你自己情况(或者直接用python3) sudo ln -s /usr/bin/python3.X /usr/bin/python

最后,可以使用 python --version 来看一下默认python的版本。

Reply View the author
SamLukeYes
deepin
2022-04-20 00:15
#6
yjmthu

两行命令

  1. 删除现有的python2的软链接 sudo rm /usr/bin/python
  2. 建立新的软链接,python3.X 具体是多少看你自己情况(或者直接用python3) sudo ln -s /usr/bin/python3.X /usr/bin/python

最后,可以使用 python --version 来看一下默认python的版本。

这样也容易出问题,万一 deepin 中的某些程序认为 python 应该指向 python2 呢doubt

Reply View the author
yjmthu
deepin
2022-04-20 00:18
#7
SamLukeYes

这样也容易出问题,万一 deepin 中的某些程序认为 python 应该指向 python2 呢doubt

那怎么办?(自己是这么干的,目前没出问题)

Reply View the author
SamLukeYes
deepin
2022-04-20 00:27
#8
yjmthu

那怎么办?(自己是这么干的,目前没出问题)

可以用 alias,或者造一个虚拟环境随便怎么弄,总之不要在系统层面改

Reply View the author
yjmthu
deepin
2022-04-20 01:47
#9
SamLukeYes

可以用 alias,或者造一个虚拟环境随便怎么弄,总之不要在系统层面改

好的。deepin先就这样吧,后天装ubuntu22.04的时候再用alias。

Reply View the author
SamLukeYes
deepin
2022-04-20 02:51
#10
yjmthu

好的。deepin先就这样吧,后天装ubuntu22.04的时候再用alias。

ubuntu 的 python 早就默认指向 python3 了,不用你操心这个

Reply View the author
匠人
deepin
2022-07-15 03:30
#11

好久没有登录了,统一回复,感谢大家解答疑惑。

Reply View the author