在2023年,在Ubuntu 18中 安装tensorflow 1.14.0

sudo apt install python3.7

sudo rm /usr/bin/python3

sudo ln /usr/bin/python3.7 /usr/bin/python3

sudo apt install python3-pip


sudo pip3 install Cython

sudo apt-get install -y glibc-doc manpages-posix-dev

 sudo pip3 install numpy==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/

sudo pip3 install pkgconfig==1.4.0

# install HDF5:具体方法在文末

 sudo pip3 install h5py==2.10.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/


 sudo pip3 install  MarkupSafe==1.1.1 -i https://pypi.tuna.tsinghua.edu.cn/simple/

应该安装2.1.3么?

Collecting MarkupSafe>=2.1.1 (from werkzeug>=0.11.15->tensorboard<1.15.0,>=1.14.0->tensorflow-gpu==1.14.0)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6d/7c/59a3248f411813f8ccba92a55feaac4bf360d29e2ff05ee7d8e1ef2d7dbf/MarkupSafe-2.1.3.tar.gz
 sudo pip3 install setuptools==57.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/

最后执行:

 sudo pip3 install tensorflow-gpu==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple/

HDF5 1.10.10

 
 
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get build-dep hdf5
 
mkdir ~/Software
cd ~/Software
wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.10/src/hdf5-1.10.10.tar.gz

tar -xf hdf5-1.8.10.tar.gz
cd hdf5-1.8.10/
./configure
make -j9
sudo make install

在2023年,在Ubuntu 18中 安装tensorflow 1.14.0_第1张图片

gpu太新了,又在另一个机器上安装了一遍,运行效果

import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'

def tf114_demo():
        a = 3
        b = 4
        c = a + b
        print("a + b in py =",c)

        a_t = tf.constant(3)
        b_t = tf.constant(4)
        c_t = a_t + b_t
        print("TensorFlow add a_t + b_t =", c_t)

        with tf.Session() as sess:
                c_t_value = sess.run(c_t)
                print("c_t_value= ", c_t_value)

        return None

if __name__ == "__main__":
        tf114_demo()

 

在2023年,在Ubuntu 18中 安装tensorflow 1.14.0_第2张图片

你可能感兴趣的:(linux,tensorflow)