centos 7 已经自带 python 2.7.15,这里需要安装 python 3
[root@pwm]# python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 19:04:19)
[GCC 7.3.0] on linux2
第一步:安装依赖包
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
第二步:下载python 3,这里下载 3.8.5
https://www.python.org/downloads/source/
wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
第三步:指定存放目录(/usr/local/python3就是python3的安装目录)
mkdir /usr/local/python3
第四步:解压压缩包,进入该目录
tar -xvJf Python-3.8.5.tar.xz
cd Python-3.8.5
./configure --prefix=/usr/local/python3
(注:./configure --prefix=/usr/local/python3这句的作用就是将程序安装在/usr/local/python3这个目录下)
第五步:安装python3
make && make install
(注:make是编译,make install是安装)
第六步:创建软链接(将 /usr/bin/python3指向/usr/local/python3/bin/python3)
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
升级pip(如果需要)
按照提示升级pip,命令:pip3 install --upgrade pip
使用:
/usr/local/python3/bin/python3
2.安装其它(直接输入命令)
pip3 install numpy
pip3 install scipy
pip3 install matplotlib
pip3 install pandas
pip3 install statsmodels
pip3 install scikit-learn
pip3 install gensim
pip3 install theano
pip3 install keras
pip3 install tensorflow
REF
https://www.cnblogs.com/zhangtingzu/p/8650664.html