본문 바로가기
  • 경제적 자유를 얻는 그날까지
엔지니어링/인공지능

[Tensor Flow] 리눅스에서 텐서 플로우 설치방법

by 베니스상인 2019. 4. 10.

1. 리눅스에 파이선이 기본적으로 설치되어 있다. 버젼을 확인해본다.

$ python --version

Python 2.7.12

 

2. pyenv를 설치한다.

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
Cloning into '/home/swift/.pyenv'...
remote: Enumerating objects: 350, done.
remote: Counting objects: 100% (350/350), done.
remote: Compressing objects: 100% (220/220), done.
remote: Total 17206 (delta 297), reused 153 (delta 126), pack-reused 16856
Receiving objects: 100% (17206/17206), 3.35 MiB | 1.81 MiB/s, done.
Resolving deltas: 100% (11705/11705), done.
Checking connectivity... done.

 

3. pyenv를 bashrc 환경설정 파일에 넣고 실행한다.

$ echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.bashrc
$ echo 'export PATH = "${PYENV_ROOT}/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc

$ source ~/.bashrc

 

4. pyenv를 실행한다.

$ pyenv install --list

Available versions:
  2.1.3
  2.2.3
  2.3.7
  2.4.0
  2.4.1
  2.4.2

.

.

.

$ pyenv install anaconda3-4.3.1

 

Downloading Anaconda3-4.3.1-Linux-x86_64.sh...
-> https://repo.continuum.io/archive/Anaconda3-4.3.1-Linux-x86_64.sh
Installing Anaconda3-4.3.1-Linux-x86_64...
Installed Anaconda3-4.3.1-Linux-x86_64 to /home/swift/.pyenv/versions/anaconda3-4.3.1

버젼과 현재 설치된 위치를 확인한다.

$ pyenv versions
* system (set by /home/swift/.pyenv/version)
  anaconda3-4.3.1

 

현재 디렉토리에서만 system이라는 버젼을 사용하도록 설정(다른 디렉토리는 다른 버젼을 사용할 수 있음)

$ mkdir Tensor_Local

$ cd Tensor_Local

$ pyenv local system

 

 

5. 필요파일 설치

 

1) 파이선 설치 2.7

$ pyenv install 2.7.6

Downloading Python-2.7.6.tgz...
-> https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
Installing Python-2.7.6...
patching file ./Modules/readline.c
patching file ./Lib/site.py
patching file ./Lib/ssl.py
Hunk #2 succeeded at 430 (offset -5 lines).
patching file ./Modules/_ssl.c
Hunk #2 succeeded at 307 (offset -1 lines).
Hunk #3 succeeded at 1809 (offset -3 lines).
patching file ./configure

 

2) 파이선 설치 3.7

$ pyenv install 3.7.3
Downloading Python-3.7.3.tar.xz...
-> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
Installing Python-3.7.3...
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Installed Python-3.7.3 to /home/swift/.pyenv/versions/3.7.3

 

3) 파이선 라이브러리 업그레이드

$ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 681kB/s 
Installing collected packages: pip
Successfully installed pip-8.1.1

 

4) 텐서 플로우 설치

$ pip install tensorflow --user
/home/swift/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting tensorflow

 

 

728x90

댓글