블로그

[파이썬] 우분투 18.04 텐서플로우 2.0 설치

우분투 18.04 에서 파이썬 텐서플로우 tensorflow 설치법입니다.

python3 으로 설치합니다.

# apt-get update
# apt-get install python3 python3-dev
# apt-get install build-essential

일단 기본적으로 컴파일할 수 있는 환경을 만든 후에 텐서플로우 파이썬 패키지를 설치합니다.

tensorflow 2 는 pip 19.0 이상에서만 설치가 가능하니 pip 를 업그레이드 합니다.

# pip install --upgrade pip

tensorflow 를 설치합니다.

# pip install tensorflow
Collecting tensorflow
  Downloading tensorflow-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl (421.8 MB)
     |████████████████████████████████| 421.8 MB 12 kB/s
Requirement already satisfied: wrapt>=1.11.1 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.12.1)
Requirement already satisfied: opt-einsum>=2.3.2 in /root/venv/lib/python3.6/site-packages (from tensorflow) (3.2.0)
Requirement already satisfied: gast==0.2.2 in /root/venv/lib/python3.6/site-packages (from tensorflow) (0.2.2)
Collecting tensorboard<2.2.0,>=2.1.0
  Downloading tensorboard-2.1.1-py3-none-any.whl (3.8 MB)
     |████████████████████████████████| 3.8 MB 344 kB/s
Collecting tensorflow-estimator<2.2.0,>=2.1.0rc0
  Downloading tensorflow_estimator-2.1.0-py2.py3-none-any.whl (448 kB)
     |████████████████████████████████| 448 kB 2.5 MB/s
Requirement already satisfied: google-pasta>=0.1.6 in /root/venv/lib/python3.6/site-packages (from tensorflow) (0.2.0)
Collecting scipy==1.4.1; python_version >= "3"
  Downloading scipy-1.4.1-cp36-cp36m-manylinux1_x86_64.whl (26.1 MB)
     |████████████████████████████████| 26.1 MB 56 kB/s
Requirement already satisfied: absl-py>=0.7.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (0.9.0)
Requirement already satisfied: keras-preprocessing>=1.1.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.1.0)
Requirement already satisfied: wheel>=0.26; python_version >= "3" in /root/venv/lib/python3.6/site-packages (from tensorflow) (0.34.2)
Requirement already satisfied: termcolor>=1.1.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.1.0)
Requirement already satisfied: six>=1.12.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.14.0)
Requirement already satisfied: keras-applications>=1.0.8 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.0.8)
Requirement already satisfied: grpcio>=1.8.6 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.28.1)
Requirement already satisfied: protobuf>=3.8.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (3.11.3)
Requirement already satisfied: astor>=0.6.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (0.8.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in /root/venv/lib/python3.6/site-packages (from tensorflow) (1.18.2)
Requirement already satisfied: google-auth<2,>=1.6.3 in /root/venv/lib/python3.6/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (1.13.1)
Requirement already satisfied: setuptools>=41.0.0 in /root/venv/lib/python3.6/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (46.1.3)
Requirement already satisfied: werkzeug>=0.11.15 in /root/venv/lib/python3.6/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (1.0.1)
Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /root/venv/lib/python3.6/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (0.4.1)
Requirement already satisfied: markdown>=2.6.8 in /root/venv/lib/python3.6/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (3.2.1)
Requirement already satisfied: requests<3,>=2.21.0 in /root/venv/lib/python3.6/site-packages (from tensorboard<2.2.0,>=2.1.0->tensorflow) (2.23.0)
Requirement already satisfied: h5py in /root/venv/lib/python3.6/site-packages (from keras-applications>=1.0.8->tensorflow) (2.10.0)
Requirement already satisfied: pyasn1-modules>=0.2.1 in /root/venv/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (0.2.8)
Requirement already satisfied: rsa<4.1,>=3.1.4 in /root/venv/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (4.0)
Requirement already satisfied: cachetools<5.0,>=2.0.0 in /root/venv/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (4.0.0)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /root/venv/lib/python3.6/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow) (1.3.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /root/venv/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (1.25.8)
Requirement already satisfied: idna<3,>=2.5 in /root/venv/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (2.9)
Requirement already satisfied: certifi>=2017.4.17 in /root/venv/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (2019.11.28)
Requirement already satisfied: chardet<4,>=3.0.2 in /root/venv/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard<2.2.0,>=2.1.0->tensorflow) (3.0.4)
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /root/venv/lib/python3.6/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.2.0,>=2.1.0->tensorflow) (0.4.8)
Requirement already satisfied: oauthlib>=3.0.0 in /root/venv/lib/python3.6/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.2.0,>=2.1.0->tensorflow) (3.1.0)
Installing collected packages: tensorboard, tensorflow-estimator, scipy, tensorflow
  Attempting uninstall: tensorboard
    Found existing installation: tensorboard 2.0.2
    Uninstalling tensorboard-2.0.2:
      Successfully uninstalled tensorboard-2.0.2
  Attempting uninstall: tensorflow-estimator
    Found existing installation: tensorflow-estimator 2.0.1
    Uninstalling tensorflow-estimator-2.0.1:
      Successfully uninstalled tensorflow-estimator-2.0.1
Successfully installed scipy-1.4.1 tensorboard-2.1.1 tensorflow-2.1.0 tensorflow-estimator-2.1.0

gpu 를 사용하지 않을 경우 cpu 버전을 따로 설치해 줍니다.

# pip install tensorflow-cpu