安装python3.5
- 通过命令行安装Python3.5,执行命令:
sudo apt-get install python3.5
2. 由于Ubuntu底层采用的是Python2.,Python3.与Python2.*是不兼容的,但是不能卸载Python2,随意
卸载会出现意想不到的后果,只要把默认的Python指向Python3即可。
注:Python3.5默认安装在/usr/local/lib/python3.5目录下,需要删除默认python link文件,重新建立连接
关系,输入如下两条命令:
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3.5 /usr/bin/python
Ubuntu下pip3的安装、升级、卸载
安装
sudo apt-get install python3-pip
升级
sudo pip3 install --upgrade pip
卸载
sudo apt-get remove python3-pip
相关库函数
matplotlib
In case anyone else stumbles upon this, just use
sudo apt-get install python3-matplotlib
There are many packages involved with matplotlib
and using apt-get
instead of pip
this is the officially recommended approach.
使用方法
%matplotlib inline
import matplotlib.pyplot as plt
numpy
See, when you install any software using pip, it defaults to the path: "/usr/local/lib/python3.5/dist-packages/numpy" for installing that software.
Only the root user has access to this area of control (better security) and so, you'll need to the keyword sudo before such commands to enable that software (in this case, pip) to perform it's operations with a root user access level.
So, your command will now become:
sudo pip3 install numpy
pandas
Python2 and Python3 uses different version of pandas.
For Python3 you can install it using apt install
:
sudo apt-get install python3-pandas
In order to install it using pip
, you should use pip3
for Python3
:
sudo apt-get install python3-pip
sudo -H pip3 install pandas