Prepare Python development environment on Ubuntu

Overview

I'm new to python, but I had to learn python to work with machine learning.

However, probably because I don't know what python is, it is installed globally by default, so I tried to set it properly and I got stuck. So I'll make a note of it.

(It may be common to use anaconda now, but I dared to try it myself.)

environment

it was helpful! : pray: Building an environment with pyenv and virtualenv

Install python3 and scientific calculation library on Ubuntu

python installation

#Check the initial state
python -V
-> 2.7.6

sudo apt-get install git gcc make openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev

# http://qiita.com/sobeit@github/items/eb24bbcc02822223d8eb
#Required to use the drawing library
sudo apt-get install python3-tk tk-dev python-tk libfreetype6-dev 

#pyenv installation
git clone https://github.com/yyuu/pyenv.git ~/.pyenv

##Setting environment variables (after confirming that it works,~/.bash_Write it in your profile. )
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"
pyenv --version
-> pyenv 20160509

#Display a list of usable items
pyenv install --list

#Try to install
pyenv install 3.5.1

#Set to the default.
pyenv global 3.5.1

python -V
-> 3.5.1

Up to this point, we have been able to use multiple versions properly. However, since it is not possible to use multiple versions of the same version, virtual-pyenv is included.


git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv

##Setting environment variables (after confirming that it works,~/.bash_Write it in your profile. )
eval "$(pyenv virtualenv-init -)"

# 3.5.Dedicate 1 to the target directory.
pyenv virtualenv 3.5.1 dev1_3.5.1
pyenv local dev1_3.5.1

python -V
-> 3.5.1

Now you can use python properly. Next, put in the library

pip install pandas
pip install matplotlib

Operation check

sample.py


import tkinter as tk
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(0, 5, 0.1)
y = np.sin(x)
plt.plot(x, y)
plt.show()

Success if the graph is displayed.

Recommended Posts

Prepare Python development environment on Ubuntu
Building a Python environment on Ubuntu
Prepare your first Python development environment
Python development environment construction on macOS
Install Python development environment on Windows 10
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
Prepare Python development environment with Atom
OpenCV3 & Python3 environment construction on Ubuntu
Build an Ubuntu python development environment on Google Cloud Platform
Until building a Python development environment using pyenv on Ubuntu 20.04
Build Python3 and OpenCV environment on Ubuntu 18.04
Python virtual environment and packages on Ubuntu
Steps to install Python environment on Ubuntu
How to prepare Python development environment [Mac]
Created Ubuntu, Python, OpenCV environment on Docker
Python development environment construction
About Python development environment
python2.7 development environment construction
build Python on Ubuntu
Install Python 3.3 on Ubuntu 12.04
Development environment in Python
Introduction to Python Let's prepare the development environment
Build python environment with pyenv on EC2 (ubuntu)
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Install python package in personal environment on Ubuntu
Python development on Ubuntu on AWS EC2 (using JupyterLab)
Build a Python development environment on your Mac
[Venv] Create a python virtual environment on Ubuntu
Build a Kubernetes environment for development on Ubuntu
Set up a Python development environment on Marvericks
Create a Python virtual development environment on Windows
Build a Python development environment on Raspberry Pi
Set up Python 3.4 on Ubuntu
Use matplotlib on Ubuntu 12 & Python
Python + Kivy development on Windows
Prepare Chainer environment on Windows
Put Python 3.x on Ubuntu
Build python3 environment with ubuntu 16.04
Build Python environment on Windows
Prepare python3 environment with Docker
Organize your Python development environment
Install OpenCV on Ubuntu + python
Django environment development on Windows 10
[ev3dev × Python] Build ev3dev development environment
Build python environment on windows
Introducing TensorFlow on Ubuntu + Python 2.7
[MEMO] [Development environment construction] Python
Ubuntu18.04 Development environment creation memo
[For organizing] Python development environment
[Day 1] Prepare Django's development environment
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Notes on creating a python development environment on macOS Catalina
Create a comfortable Python 3 (Anaconda) development environment on windows
I made a Python3 environment on Ubuntu with direnv.
Build a GVim-based Python development environment on Windows 10 (1) Installation
Build a Python development environment on Mac OS X
Build a Python development environment using pyenv on MacOS
Install Ubuntu 20.04 with GUI and prepare the development environment
Create a Python development environment on OS X Lion
Prepare Django development environment using homebrew on MacOSX Mavericks (10.9)