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

[Ubuntu 18.04] 脳死でPythonの開発環境を構築するための備忘録

More than 1 year has passed since last update.

Ubuntu用の前準備

pyenv installしたときに発生するエラーは大体以下のパッケージが入っていないことが原因。

sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl

[補足] Mac用の前準備

下記パッケージをbrewでインストール

brew install readline xz

pyenv

Cloneして~/.bash_profileに下記を追加

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

pyenv-virtualenv

Cloneして~/.bash_profileに下記を追加

git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
eval "$(pyenv virtualenv-init -)"

新しい環境作成

pyenv virtualenv 3.6.0 buffo3.6.0

切り替えはactivate/deactivateで行う

pyenv activate buffo3.6.0

今後のリリースでpromptの変更がなくなるみたいなのでexport PYENV_VIRTUALENV_DISABLE_PROMPT=1~/.bash_profileに追加しておく。

pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.

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