Help us understand the problem. What is going on with this article?

Pyenvを使用してUbuntuにPythonをインストールする

More than 1 year has passed since last update.

Ubuntu 16.04 に Python 3.6.7 をインストールします。

OS情報

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Pyenvのインストール

gitをインストールします。

$ sudo apt-get install -y git

gitからPyenvのインストーラを取得します。

$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv

Pyenvにパスを通して有効化します。

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

Pyenvのバージョンを確認します。

$ pyenv -v
pyenv 1.2.8

Pythonのインストール

$ pyenv install 3.6.7

Python 3.6.7がインストールされたことを確認します。

$ pyenv versions
* system
  3.6.7

Python 3.6.7を有効化します。

$ pyenv local 3.6.7
$ pyenv versions
  system
* 3.6.7 (set by /vagrant/.python-version)
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした