Ubuntu安装Python3 和卸载

Python2中文的解决
在py文件第一行添加

#coding=utf-8
  • 1

规范的应该这么写

#-*- coding:utf-8 -*-
  • 1

安装python

系统默认安装Python2

这里写图片描述

安装Python3的命令

sudo apt-get install python3.5
  • 1

这里写图片描述

可能无法解析主机像这样

这里写图片描述

不用管继续执行就可以了

运行Python编译器:python3 xx文件名xx.py

使用Python2 Python xx文件名xx.py
使用python3 python3 xx文件名xx.py

1、卸载python3.4

sudo apt-get remove python3.4

2、卸载python3.4及其依赖

sudo apt-get remove --auto-remove python3.4

3、清除python3.4

sudo apt-get purge python3.4
or
sudo apt-get purge --auto-remove python3.4

注释:

此方法卸载python比较彻底,所以适合更换python版本时使用。

——对于既想完全卸载python,又无法接受完全卸载后某些python组件无法使用的童鞋,请慎重!!

1、卸载python3.4

sudo apt-get remove python3.4

2、卸载python3.4及其依赖

sudo apt-get remove --auto-remove python3.4

3、清除python3.4

sudo apt-get purge python3.4
or
sudo apt-get purge --auto-remove python3.4

注释:

此方法卸载python比较彻底,所以适合更换python版本时使用。

——对于既想完全卸载python,又无法接受完全卸载后某些python组件无法使用的童鞋,请慎重!!

猜你喜欢

转载自www.cnblogs.com/wu-chao/p/9139915.html