[Pyenv] Building a python environment with ubuntu 16.04

background

--Run tensorflow on ubuntu! ――But I'm using python2 code! !! ――Then, you have to put multiple versions in pyenv! !! !!

So, "to this article"

Install pyenv

sudo git clone git://github.com/yyuu/pyenv.git ./pyenv

[pyenv] PATH setting

export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"

python installation

banaoh@ubuntu-dlw:~$ pyenv install 3.6.1

Downloading Python-3.6.1.tar.xz...
-> https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
Installing Python-3.6.1...

BUILD FAILED (Ubuntu 16.04 using python-build 1.1.1-1-g734e40d)

Inspect or clean up the working tree at /tmp/python-build.20170621142635.19271
Results logged to /tmp/python-build.20170621142635.19271.log

Last 10 log lines:
    ensurepip._main()
  File "/tmp/python-build.20170621142635.19271/Python-3.6.1/Lib/ensurepip/__init__.py", line 189, in _main
    default_pip=args.default_pip,
  File "/tmp/python-build.20170621142635.19271/Python-3.6.1/Lib/ensurepip/__init__.py", line 102, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/tmp/python-build.20170621142635.19271/Python-3.6.1/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
Makefile:1064: recipe for target 'install' failed
make: *** [install] Error 1

--Install because it says that zlib is missing

sudo apt-get install zlib1g-dev

--Install again

banaoh@ubuntu-dlw:~$ pyenv install 3.6.1

Downloading Python-3.6.1.tar.xz...
-> https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
Installing Python-3.6.1...
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (Ubuntu 16.04 using python-build 1.1.1-1-g734e40d)

Inspect or clean up the working tree at /tmp/python-build.20170621143006.3222
Results logged to /tmp/python-build.20170621143006.3222.log

Last 10 log lines:
                upgrade) ensurepip="--upgrade" ;; \
                install|*) ensurepip="" ;; \
        esac; \
         ./python -E -m ensurepip \
                $ensurepip --root=/ ; \
fi
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0

--I get an error saying "Missing the OpenSSL lib", so install libssh

sudo apt-get install libssl-dev

--"Pyenv install 3.6.1" worked! !! !!

Check python version, switch version

banaoh@ubuntu-dlw:~$ python --version
Python 2.7.12

banaoh@ubuntu-dlw:~$ pyenv global 3.6.1
banaoh@ubuntu-dlw:~$ python --version
Python 3.6.1

Recommended Posts

[Pyenv] Building a python environment with ubuntu 16.04
Building a Python environment on Ubuntu
Building a virtual environment with Python 3
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
Building a Python3 environment with Amazon Linux2
Building a Python 3.6 environment with Windows + PowerShell
Build a python virtual environment with pyenv
Until building a Python development environment using pyenv on Ubuntu 20.04
Build python environment with pyenv on EC2 (ubuntu)
Building a python environment with virtualenv and direnv
Building an Anaconda environment for Python with pyenv
Building a Python environment with WLS2 + Anaconda + PyCharm
Build python3 environment with ubuntu 16.04
Building a Python virtual environment
Building a Python virtual environment
Building a Python environment for pyenv, pyenv-virtualenv, Anaconda (Miniconda)
Recommendation of building a portable Python environment with conda
I made a Python3 environment on Ubuntu with direnv.
conda memorandum: Building a Python environment with supercomputer ITO
Building a kubernetes environment with ansible 2
Building a Python environment on Mac
Create a virtual environment with Python!
Building a kubernetes environment with ansible 1
Get a clean Python development environment with pyenv + pipx + Poetry
Build a python environment with pyenv (OS X El Capitan 10.11.3)
Build a Python environment with WSL + Pyenv + Jupyter + VS Code
[Python] Building an environment with Anaconda [Mac]
Install Python as a Framework with pyenv
Use smbus with python3 under pyenv environment
[Python] Create a virtual environment with Anaconda
[Mac] Building a virtual environment for Python
Build a modern Python environment with Neovim
Building a Python development environment for AI development
Building a Windows 7 environment for getting started with machine learning with Python
Create a USB boot Ubuntu with a Python environment for data analysis
Python environment with docker-compose
Install python with pyenv
Create a Python environment
Virtual environment with Python 3.6
Ubuntu18.04.05 Creating a python virtual environment in LTS
Build a python environment with ansible on centos6
Create a virtual environment with conda in Python
[Python] Build a Django development environment with Docker
Use multiple versions of python environment with pyenv
Create a python3 build environment with Sublime Text3
[Memo] Build a virtual environment with Pyenv + anaconda
[Python] Web development preparation (building a virtual environment)
Build a simple Python virtual environment without pyenv
A memo when creating a python environment with miniconda
Build a virtual environment with pyenv and venv
Think about building a Python 3 environment in a Mac environment
[Venv] Create a python virtual environment on Ubuntu
Commands for creating a python3 environment with virtualenv
Work in a virtual environment with Python virtualenv.
Build a Python environment with OSX El capitan
Python 3.x environment construction by Pyenv (CentOS, Ubuntu)
Quickly build a Python Django environment with IntelliJ
Building a Python environment on a Sakura VPS server
Build a Python machine learning environment with a container
Build a python execution environment with VS Code
Get a quick Python development environment with Poetry