LoginSignup
2
3

More than 5 years have passed since last update.

pyenvとPipenvの仮想環境でKivyをインストールする (Ubuntu LTS 18.04) 自分用メモ

Last updated at Posted at 2018-09-16

概要

Kivyのインストールで躓いたので、再度インストールした時に解決できるように手順をメモした。

実行環境

Ubuntu LTS 18.04
Pythonのバージョン: 3.7.0

手順

pyenvでバージョン切り替え


pyenv global 3.7.0

pipenvのインストールと仮想環境作成


pip install pipenv

インストールが完了したら、アプリを作成したいディレクトリに


pipenv install --python 3.7.0

kivyに必要なパッケージのインストール

# python~の部分はpythonのバージョンが2か3かによって書き換える(例:python3-devなど)
sudo apt-get install -y \
    python-pip \
    build-essential \
    git \
    python \
    python-dev \
    ffmpeg \
    libsdl2-dev \
    libsdl2-image-dev \
    libsdl2-mixer-dev \
    libsdl2-ttf-dev \
    libportmidi-dev \
    libswscale-dev \
    libavformat-dev \
    libavcodec-dev \
    zlib1g-dev

# 必須ではない
sudo apt-get install -y \
    libgstreamer1.0 \
    gstreamer1.0-plugins-base \
    gstreamer1.0-plugins-good

Cythonのインストール

Kivyをインストールする前にCythonを入れておく。

pipenv install cython

Kivyのインストール

pipenv install kivy

実行したコマンドまとめ

pyenv global 3.7.0

pip install pipenv

sudo apt-get install -y \
    python-pip \
    build-essential \
    git \
    python \
    python-dev \
    ffmpeg \
    libsdl2-dev \
    libsdl2-image-dev \
    libsdl2-mixer-dev \
    libsdl2-ttf-dev \
    libportmidi-dev \
    libswscale-dev \
    libavformat-dev \
    libavcodec-dev \
    zlib1g-dev

# 必須ではないが、警告が出るので一応インストール
sudo apt-get install -y \
    libgstreamer1.0 \
    gstreamer1.0-plugins-base \
    gstreamer1.0-plugins-good

pipenv install cython
pipenv install kivy

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