0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

pyenv virtualenv ワンライナーインストール

Last updated at Posted at 2021-02-10

概要

サーバなどを立てたときに、pyenv-virtualenv 環境をワンライナーでインストールします。
3.7.4 をとりあえず。

コマンド

2パターン書いています。
1パターン目はdockerコンテナとして立ち上げたubuntu環境上でのコマンド。
2パターン目はコンテナではなく立ち上げたubuntuインスタンス上でのコマンド。
違いはsudoをつけるかどうかだけです。

pyenv & virtualenv 環境 for ubuntu on docker

apt update &&apt install -y wget git&& apt install build-essential -y&& git clone https://github.com/pyenv/pyenv.git ~/.pyenv &&\
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile &&\
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile &&\
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.profile &&\
source ~/.profile &&\
apt install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev &&\
pyenv install 3.7.4 &&\
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv &&\
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile &&\
source ~/.profile &&\
pyenv virtualenv 3.7.4 myenv && pyenv global 3.7.4
export PYTHON_VERSION=3.7.7
apt update &&apt install -y wget git&& apt install build-essential -y&& git clone https://github.com/pyenv/pyenv.git ~/.pyenv &&\
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile &&\
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile &&\
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.profile &&\
source ~/.profile &&\
apt install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev &&\
pyenv install $PYTHON_VERSION &&\
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv &&\
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile &&\
source ~/.profile &&\
pyenv virtualenv $PYTHON_VERSION myenv && pyenv global $PYTHON_VERSION

pyenv & virtualenv 環境 for ubuntu NOT on docker


sudo apt update &&sudo apt install -y wget git&&sudo  apt install build-essential -y&& git clone https://github.com/pyenv/pyenv.git ~/.pyenv &&\
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile &&\
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile &&\
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.profile &&\
source ~/.profile &&\
sudo apt install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev &&\
pyenv install 3.7.4 &&\
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv &&\
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile &&\
source ~/.profile &&\
pyenv virtualenv 3.7.4 myenv && pyenv global 3.7.4
export PYTHON_VERSION=3.7.7
sudo apt update &&sudo apt install -y wget git&&sudo  apt install build-essential -y&& git clone https://github.com/pyenv/pyenv.git ~/.pyenv &&\
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile &&\
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile &&\
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.profile &&\
source ~/.profile &&\
sudo apt install -y gcc make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev &&\
pyenv install $PYTHON_VERSION &&\
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv &&\
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.profile &&\
source ~/.profile &&\
pyenv virtualenv $PYTHON_VERSION myenv && pyenv global $PYTHON_VERSION
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?