1.wget获取安装包:
wget http://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz
2.解压安装包:
tar -xvzf Python-3.6.2.tgz
3.检查安装平台属性,系统是否有编译时所需要额库,以及库的版本是否满足编译需要
./configure --prefix=/usr/local/python3.7 --enable-optimizations --with-ssl
4.编译源码
编译需要很多的库
sudo apt update
sudo apt install -y make build-essential libssl-dev zlib1g-dev libffi-dev gcc
sudo apt install -y libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm
sudo apt install -y libncurses5-dev libncursesw5-dev xz-utils tk-dev
make -j4
5.成功编译之后,安装
sudo make install
在安装完之后,我们希望用pip3命令来安装numpy。首先,用如下命令安装pip3:
sudo install python3-pip
创建软连接:
sudo ln -s /usr/local/python3.7/bin/python3.7 /usr/local/bin/python3.7
sudo ln -s /usr/local/python3.7/bin/pip3.7 /usr/local/bin/pip3
-------------------------------------------------------------------
Pycharm安装
1. 下载
2. 解压 tar -zxvf pycharm-professional-2018.2.5.tar.gz
3. 更改hosts文件(sudo vim etc/hosts ),添加一行代码:0.0.0.0 account.jetbrains.com
桌面图标:
sudo touch /usr/share/applications/pycharm.desktop
sudo vim /usr/share/applications/pycharm.desktop
写入以下内容:
[Desktop Entry] Version=1.0 Type=Application Name=PyCharm Icon=/home/vickyleexy/Downloads/pycharm-2018.2.5/bin/pycharm.png 图标文件的位置 Exec=/home/vickyleexy/Downloads/pycharm-2018.2.5/bin/pycharm.sh 启动文件的位置 Comment=The Drive to Develop Categories=Development;IDE; Terminal=false StartupWMClass=jetbrains-pycharm
sudo chmod u+x /usr/share/applications/pycharm.desktop 加可执行权限