LoginSignup
1
1

More than 5 years have passed since last update.

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

Posted at

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.

1
1
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
1
1