Summary: Ubuntu Python2.x and

Environment: Just reinstalled the system, it is Ubuntu 16.04
Purpose: Install Python3.x, install 3.5.2 in this example
step:

  1. $ python --version
    python 2.7 --->The version installed by default
  2. Go to https://www.python.org/downloads/ to download the corresponding version
  3. Install the downloaded version

Problem 1: When executing sudo make install, you may encounter an error, similar to zipimport.ZipImportError: can't decompress data, lack of zlib. So start another terminal: sudo apt-get update. Not enough, enter update in the Ubuntu search box , Select Software Updater, it will automatically check to update, if it prompts that there is software that needs to be updated, click update to restart the computer to take effect. At this point, sudo apt-get install zlib can be installed successfully, and then sudo make install can also be successful.

Question 2: At this time python --version, the system still returns to the 2.7 version. However you want to use the 3.x version
Solution steps:

At this time, python --version will prompt python 3.x

Problem 3: Installing sudo apt-get install python-pip will report an error: ImportError: No module named'pip'; installing sudo apt-get install python-setuptools is successful, but easy_install --version will report an error: pkg_resources.DistributionNotFound
Solution steps:

Then easy_install --version; pip --version will return the version number.

Recommended Posts

Summary: Ubuntu Python2.x and
ubuntu16.04 security summary-01
Summary of Ubuntu system and privacy cleaning tools
Ubuntu20.04 experience and beautification
Ubuntu introduction and installation
[python] python2 and python3 under ubuntu
Ubuntu backup and restore
Summary of ubuntu usage
Ubuntu 16.04 compile and install PHP 7.2
ubuntu18.04 compile and install python3.8
Ubuntu16.04 installation and simple configuration
Jmeter (18)_Ubuntu deploy jmeter and ant
ubuntu install and configure GitLab
Ubuntu deployment and experience Nexus3
Ubuntu16.04 install SVN and configuration
Summary of various ubuntu problems
The difference between python2.x and python3.x
Ubuntu16.04 install and uninstall VMware-Workstation 14
Ubuntu PostgreSQL installation and configuration
Ubuntu creates users adduser and useradd
The difference between CentOS and Ubuntu
Ubuntu environment variables and ADB configuration
Netweaver and Windows, Ubuntu data sharing
Install and configure MySQL on Ubuntu
Summary of Ubuntu commonly used commands
Install and configure Docker in Ubuntu
ubuntu modify and configure ip address
Ubuntu16.04 configuration OpenCV3.4.2 and basic use
Install and deploy Gerrit under Ubuntu
Redis installation under ubuntu and windows
Install nodejs and npm under Ubuntu 16.04
Ubuntu change password and username steps
Protect your eyes (ubuntu and chrome)
Ubuntu 19.1 installation and configuration Chinese environment
Configuration and beautification after Ubuntu installation (1)
Nginx installation and configuration load (ubuntu12.04)
Ubuntu upgrade software and ubuntu upgrade system commands
Ubuntu common instructions and usage details
Ubuntu18.04 installation Anaconda3 and VSCode guide
Coexistence of CUDA8.0 and CUDA9.0 under Ubuntu 16.04
Ubuntu configuration source and installation software
Compile and install QEMU under Ubuntu
Windows Ubuntu subsystem ssh and ftp
Linux basics (Ubuntu copy and paste)
FreeFileSync: Compare and synchronize files in Ubuntu
ubuntu Docker installation and deployment of Rancher
Install Gnome and VNC on Ubuntu Server
Ubuntu installation and deployment Redash operation notes (2020.08)
Linux development preparation-install VMware and run Ubuntu
Python process and thread summary case analysis
51 MCU program development and download under Ubuntu
Ubuntu18.04 system installation and prerequisite software installation guide
[Daily] Win10 open and install ubuntu subsystem
Ubuntu install Elasticsearch and elasticsearch-analysis-ik word segmentation
Installation and uninstallation of CUDA under Ubuntu 16.04
Install docker on ubuntu and basic usage
Ubuntu19.10 compile and run C language program
Ubuntu18.04 Server version installation and use (graphic)
Installation and deployment of Nginx in Ubuntu
Install fonts on Ubuntu and switch default fonts
Installation and use of Win10 subsystem Ubuntu