简体   繁体   English

我如何删除 python 2.7,因为我已经在 ubuntu 上安装了 3.6.5?

[英]How can i remove python 2.7 as i already have 3.6.5 installed on ubuntu?

i have both 2.7 as well as 3.6.5 installed , at first in ubuntu 18.04 the only python version available was 3.6 but after i installed numpy package, along with it 2.7 got installed as well and it turned into default.我同时安装了 2.7 和 3.6.5,起初在 ubuntu 18.04 中唯一可用的 python 版本是 3.6,但在我安装 numpy 包之后,2.7 也安装了,它变成了默认版本。 Is there any solution so as to make 3.6 the default one instead of 2.7??有什么解决方案可以使 3.6 成为默认的而不是 2.7 吗??

Open .bashrc file nano ~/.bashrc .打开 .bashrc 文件nano ~/.bashrc Type alias python=python3 on to a new line at the top of the file then save and close the file with ctrl+o and ctrl+x .在文件顶部的新行中键入alias python=python3 ,然后使用ctrl+octrl+x保存并关闭文件。

I set python 3 version as default using the following commands:我使用以下命令将 python 3 版本设置为默认版本:

  1. Check python version on terminal - python --version在终端上检查 python 版本 - python --version
  2. Get root user privileges.获取 root 用户权限。 On terminal type - sudo su在终端类型上 - sudo su
  3. If needed write down the root user password.如果需要,记下 root 用户密码。
  4. Execute this command to switch to python 3.6.执行此命令切换到python 3.6。 update-alternatives --install /usr/bin/python python /usr/bin/python3 1
  5. Check python version - python --version检查 python 版本 - python --version
  6. Write exit to exit the root modeexit退出root模式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在已经包含 python 3.7.5 的 Ubuntu 19.10 上安装 python 3.6.5? - How do I install python 3.6.5 on my Ubuntu 19.10 that already contains python 3.7.5? 当我已经安装了python 3.6时,如何在运行python(和pipenv)2.7的pycharm中设置虚拟环境? - How do I set up a virtual environment in pycharm which runs python (and pipenv) 2.7 when I already have python 3.6 installed? scrapy需要python 2.7,但我已经拥有了 - scrapy requires python 2.7 but i already have 当我已经安装了 3.8 时,为什么我的 Mac 使用 python 2.7? - Why is my Mac using python 2.7 when I have 3.8 already installed? 如何在 Ubuntu 20.04 中为 Python2.7 安装 pip - How can I install pip for Python2.7 in Ubuntu 20.04 我无法安装numpy,因为它找不到python 2.7,虽然我已经安装了python - I cannot install numpy because it can't find python 2.7, althought I have installed python 如何在Linux上的Python 2.7中绑定已经存在的套接字? - How can I bind already existing socket in Python 2.7 on Linux? 如果我已经安装了Anaconda Python,如何在R中使用TensorFlow? - How to use TensorFlow in R if I have Anaconda Python already installed? 已安装Python 3.6.5,但该文件采用python 2.7作为默认文件 - Python 3.6.5 installed but the file taking python 2.7 as a default 如何在 ubuntu 上将我的 python 版本从 3.7.5 降级到 3.6.5 - How do I downgrade my version of python from 3.7.5 to 3.6.5 on ubuntu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM