Super Primer to python-Getting started with python3.5 in 3 minutes

Overview

In this article, I quickly created a virtual environment for centos on my PC. The purpose is to install python3.5 in it and play with it.

First, prepare vagrant

The method of launching centos using vagrant was still introduced in "here", so please have a look if you are interested.

step1. Preparation

In order to use vagrant, you need to prepare the following two.

  1. Install VirtualBox
  2. Install vagrant

It's 1 minute so far.

step2. Get centos7 with vagrant

Create a suitable directory and put centos7 in it.

$ mkdir test_centos
$ cd test_centos
$ vagrant init CentOS7
$ vagrant up
#Now that you have the environment for centos7, let's go in with ssh and check it.
$ vagrant ssh
Last login: Fri Apr 14 00:32:50 2017 from 10.0.2.2
Welcome to your Vagrant-built virtual machine.
[vagrant@localhost ~]$ cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
#It looks like it's in

step3. Get python3

In yum's default repository, python only contains 2.7. Therefore, I will add a repository called ius.

[vagrant@localhost ~]$ sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm
[vagrant@localhost ~]$ sudo yum install -y python35u python35u-libs python35u-devel python35u-pip

When I check the version, it's okay ...

[vagrant@localhost ~]$ python -V
Python 2.7.5

Aw. ..

Apparently it seems to be related to bin alias, so it seems good to change it below.

step4. Change python symbolic to python3

Current status

[vagrant@localhost ~]$ ll /bin/py*
-rwxr-xr-x.1 root root 78 June 17 2014/bin/pydoc
lrwxrwxrwx 1 root root 8 april 14 00:35 /bin/pydoc3 -> pydoc3.4
-rwxr-xr-x 1 root root 78 November 9 17:26 /bin/pydoc3.4
-rwxr-xr-x 1 root root 78 January 17 21:36 /bin/pydoc3.5
lrwxrwxrwx 1 root root 12 april 14 00:38 /bin/python -> /bin/python2
lrwxrwxrwx.1 root root 9 July 16 2015/bin/python2 -> python2.7
-rwxr-xr-x.1 root root 7136 June 17 2014/bin/python2.7
-rwxr-xr-x 2 root root 11312 November 9 17:27 /bin/python3.4
-rwxr-xr-x 2 root root 11312 November 9 17:27 /bin/python3.4m
-rwxr-xr-x 2 root root 11312 January 17 21:37 /bin/python3.5
-rwxr-xr-x 2 root root 11312 January 17 21:37 /bin/python3.5m
-rwxr-xr-x 1 root root 173 January 17 21:36 /bin/python3.5m-config
-rwxr-xr-x 1 root root 3398 January 17 21:34 /bin/python3.5m-x86_64-config
lrwxrwxrwx 1 root root 10 april 14 00:35 /bin/pyvenv -> pyvenv-3.4
-rwxr-xr-x 1 root root 230 November 9 17:26 /bin/pyvenv-3.4
-rwxr-xr-x 1 root root 230 January 17 21:36 /bin/pyvenv-3.5

Summary

command Destination さらにそれのDestination
python pythn2 python2.7

It would be nice if python could be directed to python3> python3.5.

##First of all, the direction of python3 is python3.Create an alias to be 5
[vagrant@localhost ~]$ sudo ln -s /bin/python3.5 /bin/python3
##I will erase the existing python alias
[vagrant@localhost ~]$ sudo unlink /bin/python
##python should be directed to python3
[vagrant@localhost ~]$ ln -s /bin/python3 /bin/python
[vagrant@localhost ~]$ python -V
Python 3.5.3

Sounds good.

It seems good to finally pip together.

[vagrant@localhost ~]$ sudo ln -s /bin/pip3.5 /bin/pip

In just 3 minutes so far, I was able to get centos7 and python3.5 in my environment. My purpose is scraping, but it's a really easy and convenient world.

Recommended Posts

Super Primer to python-Getting started with python3.5 in 3 minutes
Link to get started with python
How to get started with Python
Get started with Python in Blender
Try logging in to qiita with Python
How to work with BigQuery in Python
[Python] Pandas to fully understand in 10 minutes
Get Started with TopCoder in Python (2020 Edition)
To work with timestamp stations in Python
Get started with Python in 30 minutes! Development environment construction & learn basic grammar
[REAPER] How to play with Reascript in Python
Convert PDFs to images in bulk with Python
Introduction to Tornado (1): Python web framework started with Tornado
Log in to Yahoo Business with Selenium Python
How to use tkinter with python in pyenv
Getting started with AWS IoT easily in Python
A layman wants to get started with Python
Materials to read when getting started with Python
Settings for getting started with MongoDB in python
Django 1.11 started with Python3.6
1.1 Getting Started with Python
Getting Started with Python
Getting Started with Python
Clogged with pip in python super primer (from: can't read / var / mail / PIL)
How to convert / restore a string with [] in python
Explain in detail how to make sounds with python
I tried to get started with blender python script_Part 01
How to run tests in bulk with Python unittest
Convert the image in .zip to PDF with Python
I tried to get started with blender python script_Part 02
I was addicted to scraping with Selenium (+ Python) in 2020
I want to work with a robot in python.
Sample code to get started with GLSL shaders in Processing (either Java or Python)
Connect to BigQuery with Python
Getting Started with Python Functions
Scraping with selenium in Python
To flush stdout in Python
Working with LibreOffice in Python
Scraping with chromedriver in python
Debugging with pdb in Python
Login to website in Python
Post to slack with Python 3
Getting Started with Python Django (1)
Working with sounds in Python
Scraping with Selenium in Python
Super tiny struct in python
Getting Started with Python Django (4)
Getting Started with Python Django (3)
Scraping with Tor in Python
Tweet with image in Python
Combined with permutations in Python
Speech to speech in python [text to speech]
Switch python to 2.7 with alternatives
Write to csv with Python
Getting Started with Python Django (6)
Get started with Python! ~ ② Grammar ~
How to develop in Python
Python3 | Getting Started with numpy
Getting Started with Python Django (5)
Post to Slack in Python
[Road to intermediate Python] Install packages in bulk with pip