Centos7安装python3、numpy、scipy、matplotlib、pandas等

centos7已经自带python2.7.5,这里需要安装python3

第一步:安装依赖包

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

第二步:下载python3,这里下载3.6.2

wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz

第三步:指定存放目录(/usr/local/python3就是python3的安装目录)

mkdir /usr/local/python3

第四步:解压压缩包,进入该目录

tar -xvJf  Python-3.6.2.tar.xz
cd Python-3.6.2
./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

 

2.安装其它(直接输入命令)

pip3 install numpy

pip3 install scipy

pip3 install matplotlib

pip3 install pandas

pip3 install statsmodels

pip3 install scikit-learn

 pip3 install theano

pip3 install tensorflow

pip3 install keras

pip3 install gensim

 

pandas已安装,导入模块却显示ImportError:No module named ‘pandas’,仅需对库进行简单的更新即可解决!

pip --default-timeout=2000 install --user --ignore-installed -i https://pypi.tuna.tsinghua.edu.cn/simple pandas

 

Pip3 warning

sudo pip3 install -U pip

sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta

sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.14.0+nv19.7

 

转载于:https://www.cnblogs.com/zhangtingzu/p/8650664.html

上一篇:微信小程序问题总结


下一篇:部署LNMP