Build Python 3.8 + Pipenv environment on Ubuntu 18.04

Introduction

Since the environment was built on Ubuntu 18.04, I will leave it as a work memo. Use pyenv to install Python 3.8.

environment

Ubuntu 18.04.3 LTS

procedure

1. Git installation

$ sudo apt install git

2. pyenv installation

Clone pyenv from github.

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

Set the path to an environment variable. For Ubuntu, write it in .bashrc instead of .bash_profile. [reference] https://github.com/pyenv/pyenv#basic-github-checkout

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc

Set pyenv to start when the shell starts.

$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc

Shell reload & install confirmation.

$ exec "$SHELL"
$ pyenv --version
pyenv 1.2.15-2-g22c02022

3. Python3.8 installation

Install the packages needed to build Python. [reference] https://github.com/pyenv/pyenv/wiki#suggested-build-environment

$ sudo apt-get update; sudo apt-get install --no-install-recommends 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

Install Python 3.8.0 (wait patiently as it will take some time)

$ pyenv install 3.8.0

Installation confirmation

$ pyenv versions
* system
  3.8.0

4. Specify Python to use locally

Python 3.8 is not enabled just by installing with pyenv, so specify the version explicitly.

$ mkdir -p ~/sample/py38
$ cd ~/sample/py38
$ pyenv local 3.8.0

Python3.8 is enabled under the local (below the py38 directory in the above example). (Same for pip command)

$ python --version
Python 3.8.0
$ pip --versoin
pip 19.2.3

5. Pipenv installation

$ pip install pipenv
$ pipenv --version
pipenv, version 2018.11.26

6. Create Pipenv project

If you specify PIPENV_VENV_IN_PROJECT = true in the environment variable, the venv directory will be created directly under the project. Since it is easy to link with vscode, set it to true here.

$ mkdir pipenvdemo
$ cd pipenvdemo
$ export PIPENV_VENV_IN_PROJECT=true
$ pipenv --python 3

Recommended Posts

Build Python 3.8 + Pipenv environment on Ubuntu 18.04
build Python on Ubuntu
Build Python3 and OpenCV environment on Ubuntu 18.04
Build python3 environment with ubuntu 16.04
Build python environment on windows
Build python environment with pyenv on EC2 (ubuntu)
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Prepare Python development environment on Ubuntu
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Building a Python environment on Ubuntu
Build a python3 environment on CentOS7
OpenCV3 & Python3 environment construction on Ubuntu
How to build a new python virtual environment on Ubuntu
Build an Ubuntu python development environment on Google Cloud Platform
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Build a python environment on MacOS (Catallina)
Python virtual environment and packages on Ubuntu
Steps to install Python environment on Ubuntu
Build Python environment with Anaconda on Mac
Build a Python + OpenCV environment on Cloud9
python virtual environment Pipenv
Install Python 3.3 on Ubuntu 12.04
# 3 Build a Python (Django) environment on AWS EC2 instance (ubuntu18.04) part2
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Build Python environment on Ubuntu (when pip is not the default)
Simply build a Python 3 execution environment on Windows
[Latest] How to build Java environment on Ubuntu
Install python package in personal environment on Ubuntu
Build a python environment with ansible on centos6
Build a Python environment on Mac (Mountain Lion)
Build a Python development environment on your Mac
[Venv] Create a python virtual environment on Ubuntu
Build Python3 + flask environment on GCP Compute Engine
Build a Kubernetes environment for development on Ubuntu
How to build Java environment on Ubuntu (Linux)
Build a Python development environment on Raspberry Pi
Set up Python 3.4 on Ubuntu
Use matplotlib on Ubuntu 12 & Python
Put Python 3.x on Ubuntu
Build python environment with direnv
Install OpenCV on Ubuntu + python
Introducing TensorFlow on Ubuntu + Python 2.7
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Install Python3 on Mac and build environment [Definitive Edition]
Build a machine learning Python environment on Mac OS
I made a Python3 environment on Ubuntu with direnv.
Build a GVim-based Python development environment on Windows 10 (1) Installation
How to build a Django (python) environment on docker
Build a Python development environment on Mac OS X
Build a Python environment on your Mac using pyenv
Build a Python development environment using pyenv on MacOS
How to build a Python environment on amazon linux 2
docker build python based on alpine
Building a Python environment on Mac
Build a python machine learning study environment on macOS sierra
Install Python 3.8 on Ubuntu 18.04 (OS standard)
Python environment construction memo on Windows 10
Build an environment for machine learning using Python on MacOSX
Python 3.4 pyvenv fails on Ubuntu 14.04 LTS
Anaconda python environment construction on Windows 10