注:CentOS7下自带Python27环境,Python3环境需要自己安装。若在安装完python3后,yum安装了包,需要重新编译Python3才可使得python环境中支持该包,否则,及时yum安装了,python也找不到该包。
0、提前搭建好nvidia驱动、CUDA、CUDNN
在物理机联网,没有做网络特殊限制的情况下,直接修改如下文件,进行联网
vim /etc/resolv.conf
加上
nameserver 114.114.114.114
1、安装pip的依赖
yum install openssl -y
yum install openssl-devel -y
安装一个包,使python交互界面,退格可以正常使用
yum install readline-devel
2、下载Python35源码包
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
3、安装源码包
tar -zxf Python-3.5.2.tgz
cd Python-3.5.2
mkdir /usr/local/python3
./configure --prefix=/usr/local/python3
make
make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
4、测试python3
python3
5、安装setuptools
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz
tar -zxvf setuptools-19.6.tar.gz
cd setuptools-19.6
python3 setup.py build
python3 setup.py install
6、安装pip3
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
7、安装tensorflow
如果出现不能安装的情况,更新pip再安装,不更新,会找不到pip包
pip3 install --upgrade pip
pip3 install tensorflow-gpu==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/
如果出现Read Time Out,则加上以下参数
pip3 --default-timeout=1000 install tensorflow-gpu==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/
8、安装jupyter
pip3 install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple/
vim /etc/profile
最后加上:export PATH=$PATH:/usr/local/python3/bin
source /etc/profile
yum install sqlite-devel
重新编译Python
cd Python-3.5.2
./configure --prefix=/usr/local/python3
make
make install
9、测试jupyter
jupyter notebook --allow-root --no-browser --port 5003 --ip=0.0.0.0 --notebook-dir=/root
10、复制屏幕上的路径,将master改成自己的ip就可以连接了