vitrualBox+ubuntu16.04 install python3.6 latest tutorial and detailed steps

vitrualBox+ubuntu16.04 install python3.6 latest tutorial and detailed steps

Because I need to use Ubuntu+Python 3.6 version to learn deep learning these days, I installed it according to the online instructions, but Ubuntu 16.04 comes with Python 2.7 and 3.5 versions, so they need to be installed separately. But I spent half a day installing it and wasted a whole day hitting various pitfalls. Finally, I succeeded. Therefore, I wrote this tutorial to help future generations avoid going astray.

Here are some tips along the way:

When installing Ubuntu 16, the language pack will be downloaded at the end. Since it uses foreign sources, it will take a lot of time, so you can click skip to skip it first. Modify the source later and continue the installation.

insert image description here

Find Software and Updates in the search, where you can switch the download source. I chose Alibaba Cloud.

insert image description here

Then find language support in the search, download the language pack and you're done. Next is the highlight, install python3.6

Install python3.6

1. I followed the online tutorial to install it and found that I could not add and install it through the following instructions

sudo add-apt-repository ppa:jonathonf/python-3.6 //Don't use this

It is best to download the installation package from https://www.python.org/ftp/python/3.6.5/ and put the installation package in Ubuntu through a shared folder.

2. If the shared folder cannot be accessed

Add the current user name to the vboxsf user group (my user name is frio), and restart the system.

sudo adduser frio vboxsf

3. Then it is the process of installing python3.6

Right click in the shared folder to open the terminal and access this folder.

Then unzip the file

tar xfz Python-3.6.5.tgz

Note: The xfz command is used here, and the -xvzf command is not recommended because the released folder requires root permissions to be changed or deleted.

Enter the unzipped folder and add configuration

cd Python-3.6.5/
./configure "--prefix=/usr/bin/python3.6"

What needs to be configured is the folder where Python is installed. After the configuration is completed, the terminal will display the following paragraph. You can choose to ignore it without affecting subsequent operations.

If you want a release build with all optimizations active (LTO, PGO, etc),

please run ./configure –enable-optimizations

Compile source code

sudo make

The compilation process takes several minutes and may report errors, depending on the version of gcc you installed.

Perform the installation

sudo make install

The installation process takes a few minutes. After successful installation, the installed Python will be in the /usr/bin/python3.6 folder on your computer.

Here it may be reported that the zlib dependency package is missing and the installation fails.

Solution

Install GCC toolchain

sudo apt install build-essential

Install various dependencies

sudo apt install libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev

Go here and re-install.

Modify the default Python version

Ubuntu 16.04 integrates Python 2.7 and 3.5. The original python in the system is in /usr/bin/python. Through ls -l, you can see that python is a soft link to python 2.7 in this directory.

We need to delete this default link first, and then create a new soft link for python3.6. First, make sure the terminal pointer has returned to the root directory before performing the following operations.

You need to delete the original Python link file:

rm /usr/bin/python

Note that if the terminal prompts: rm: cannot delete '/usr/bin/python': insufficient permissions, then you need to use sudo or open root permissions to delete the link.

Create a link to Python 3.6. If you do not have sufficient permissions, use root or sudo to add the command:

ln -s /usr/bin/python3.6/bin/python3.6 /usr/bin/python

Query Python version

python@ubuntu:~$ python -V
Python 3.6.5

The installation is successful here.

Summarize

The above is the latest tutorial and detailed steps for installing python3.6 on vitrualBox+ubuntu16.04 introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Detailed steps to install python3.6.5 on Ubuntu16.04
  • Detailed explanation of installing Python 3.7 and pip3 in Ubuntu 16.04 and switching to the default version
  • How to set python3 as the default command in ubuntu16.04
  • How to create and run a Django project in Ubuntu 16.04 under Python 3
  • Ubuntu 16.04 creates a development environment for vim and python3
  • Ubuntu16.04/Raspberry Pi Python3+opencv configuration tutorial (sharing)
  • How to configure OpenCV3.2 in Python3.5 on Linux-ubuntu16.04
  • Problems and solutions for installing multiple python versions in Ubuntu 16.04

<<:  The most complete package.json analysis

>>:  Steps to enable MySQL database monitoring binlog

Recommend

Linux disk space release problem summary

The /partition utilization of a server in IDC is ...

XHTML: Frame structure tag

Frame structure tag <frameset></frameset...

CSS float (float, clear) popular explanation and experience sharing

I came into contact with CSS a long time ago, but...

How to import CSS styles into HTML external style sheets

The link-in style is to put all the styles in one...

Do you know how to use the flash wmode attribute in web pages?

When doing web development, you may encounter the...

JavaScript implements click toggle function

This article example shares the specific code of ...

Let's talk about MySQL joint query in detail

Table of contents Union query 1. Query the ID and...

HTML framework_Powernode Java Academy

1. Framework A browser document window can only d...

JavaScript function call, apply and bind method case study

Summarize 1. Similarities Both can change the int...

Small program to implement a simple calculator

This article example shares the specific code of ...

MySQL series: redo log, undo log and binlog detailed explanation

Implementation of transactions The redo log ensur...

nuxt.js multiple environment variable configuration

Table of contents 1. Introduction 2. Scenario 3. ...

About VSCode formatting JS automatically adding or removing semicolons

introduction It is okay to add or not add a semic...