LoginSignup
2
3

More than 5 years have passed since last update.

【Jenkins備忘録】Python自動テスト環境構築①Python準備編

Last updated at Posted at 2018-06-09

・Ubuntu16.04のインストールが完了したところからスタート

マシンスペック & OS

OS Linux Ubuntu 16.04 64bit
CPU Core2 Duo
RAM 4GB
ROM 80GB

Python3.6のインストール


# とりあえずアップデート  
$ sudo apt-get update
# gitをインストール  
$ sudo apt-get install git  

# Pythonのビルドに必要なライブラリをインストール  
$ sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libbz2-dev libreadline-dev

pyenvのセットアップ

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
$ echo 'eval "$(pyenv init -)"' >> ~/.profile
$ source ~/.profile

Python3.6.0をインストール

・pyenvでインストール。


$ pyenv install 3.6.0

Python3.6.0をデフォルトに設定

・Ubuntu16.04のデフォルトPythonのバージョンは2.7なので、
 以下のコマンドを実行してインストールしたPython3.6.0バージョンを切り替える。


# 変更前確認  
$ python --version

# Python3.6.0をglobalに設定  
$ pyenv global 3.6.0

# version確認 
$ python --version
2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3