[LINUX] Studying Python Part.1 Creating an environment

Introduction

I'm going to use Python for work, so I'll leave it as a memo. All the information is already on many sites, I will use this place because it is easy to follow by writing an article.

Environment creation

Since we are planning to adopt python 3.5.0, we will start from creating this environment.

OS installation

Create an environment with Amazon Web Service that can be used free of charge for one year. Select and create an Amazon Linux AMI that is free and easy to build. Please refer to another article for this.

First, create an instance of EC2

After creating the instance

  1. Network & Security
  2. Select Elastic IP
  3. Assign a new address to get a public IP address
  4. Perform the address association in the "Action" menu
  5. Set and associate the created instance with a private IP address
  6. This is a measure to prevent the global IP address from changing when the server is restarted.
  7. Remote login with SSH
  8. Log in with SSH (in my case, teraterm) using the pem file downloaded when creating the instance
  9. Log in as the ec2-user user
  10. Just in case, change the password with # passwd ec2-user
  11. Change root password `` `# sudo su -``` to root
  12. Change root password with # passwd
  13. Log out once
  14. Login with `# su --`
  15. yum update
  16. Update your system with `` `# yum update -y```

Create a python environment

It was quite difficult. .. ..

But once you know it, it's easy.

Prerequisites: Use python 3.5.0 with ec2-user Manage python with pyenv

  1. Install the required functions for pyenv
  2. Become the root user
  3. Install what you need with yum
  4. # yum install mlocate openssl-devel bzip2-devel zlib-devel bzip2 bzip2-devel readline-devel sqlite3 sqlite-devel openssl-devel gcc gcc-c++ git
  5. Return to the original user with `` `# exit```
  6. Install pyenv # git clone https://github.com/yyuu/pyenv.git ~ / .pyenv
  7. Add the following to your profile with `` `# vi .bash_profile```

export PYENV_ROOT="{HOME}/.pyenv" if [ -d "{PYENV_ROOT}" ]; then export PATH={PYENV_ROOT}/bin:PATH eval "$(pyenv init -)" fi

  1. Read with # source ~ / .bash_profile
  2. Install python `` `# pyenv install 3.5.0```
  3. Check the current status with `` `# pyenv versions ```

* system  3.5.0 (set by /home/ec2-user/.pyenv/version)

  1. Change the version of python `` `# pyenv global 3.5.0```
  2. Check the current status again with # pyenv versions

system * 3.5.0 (set by /home/ec2-user/.pyenv/version)

  1. Confirm that the version has been changed
  2. Check the version of python itself # python -V

Python 3.5.0

  1. Log out remotely and log in again to reconfirm the python version.
  2. If there is no problem, this completes the environment creation

At the end

There are many ways to install it, but I think this is the easiest.

Recommended Posts

Studying Python Part.1 Creating an environment
Note when creating an environment with python
Studying Python with freeCodeCamp part1
Creating an egg with python
Studying Python with freeCodeCamp part2
Studying python
When creating an environment that uses python django on Ubuntu 12.04 LTS
[Python] Building an environment with Anaconda [Mac]
Build an environment for Blender built-in Python
Creating an Ubuntu 18.04 + MAAS2.4 environment starting from 0
Creating an unknown Pokemon with StyleGAN2 [Part 1]
Creating amateur python environment settings (for MAC)
Creating an unknown Pokemon with StyleGAN2 [Part 2]
Creating a python virtual environment on Windows
Create an OpenCV3 + python3 environment on OSX
Creating a virtual environment in an Anaconda environment
QGIS + Python Part 2
Python environment construction
python environment settings
QGIS + Python Part 1
Environment construction (python)
[Python] Start studying
python environment construction
Python --Environment construction
Python: Scraping Part 1
Python environment construction
python environment construction
Python3 Beginning Part 1
Python: Scraping Part 2
Ubuntu18.04.05 Creating a python virtual environment in LTS
Building an environment that uses Python in Eclipse
Building an environment for executing Python scripts (for mac)
Building an Anaconda environment for Python with pyenv
Create an environment of 64bit Windows + python 2.7 + MeCab 0.996
Install the python package in an offline environment
A memo when creating a python environment with miniconda
[Python] Create an asynchronous task execution environment + monitoring environment
Commands for creating a python3 environment with virtualenv
Procedure for creating a Python quarantine environment (venv environment)
Introduction to Python "Re" 1 Building an execution environment
A memo for creating a python environment by a beginner
My python environment memo
Python: Creating a virtual environment (venv), starting and stopping
Build an interactive environment for machine learning in Python
Unification of Python environment
python windows environment construction
Notes on creating a python development environment on macOS Catalina
Python development environment construction
python virtual environment Pipenv
Python basic memorandum part 2
Building an environment for natural language processing with Python
About Python development environment
Web application made with Python3.4 + Django (Part.1 Environment construction)
virtual environment in python
Python basic memo --Part 2
Python environment with docker-compose
python2.7 development environment construction
Create a Python environment
Development environment in Python
Mac environment construction Python
Python basic memo --Part 1