install pip3
在python3环境下安装包,输入:
pip3 install matplotlib
(注:系统可能提示你在这之前需要安装pip3:The program ‘pip3’ is currently not installed. You can install it by typing: >sudo apt install python3-pip)
安装完成后依次输入
python 3
import matplotlib
如果没有报错说明安装成功
卸载命令:
sudo pip uninstall matplotlib
sudo pip3 uninstall matplotlib
关于版本查看:
添加PPA:
sudo add-apt-repository ppa:jonathonf/python-3.6
查看更新和安装更新:
sudo apt-get update #貌似是检查并安装全部更新?好像可以忽略
sudo apt-get install python3.6
更换命令行中的python默认版本
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
or
alias python=python3
# To revert back:
alias python=python2
查看python默认版本
python -V
切换版本:
sudo update-alternatives --config python3
remove python3:
sudo apt-get remove 'python3.*'
切换版本:
sudo update-alternatives --config python3
Ubuntu中python升级到3.6
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
sudo apt install spyder3
sudo rm /usr/bin/python
sudo ln -s /usr/local/bin/python3.6 /usr/bin/python
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
sudo update-alternatives --config python3
python -V
修改为对应的pip版本
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
sudo python get-pip.py