Steps to install Pyenv under Deepin

Steps to install Pyenv under Deepin

Preface

In the past, I always switched Python versions by modifying the soft link in the /bin/ directory, which was very inconvenient and it was also very cumbersome to install a new Python version. I tried pyenv and instantly felt that it was really good. I recorded the installation process notes.

Install

Install dependent libraries

This step is required, otherwise the Python compiler will report a warning or exception, causing some extensions to be unusable, for example:

WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Installation command:

# sudo apt install libssl-dev zlib1g-dev libbz2-dev \
     libreadline-dev libsqlite3-dev libffi-dev \
     libncurses5-dev libncursesw5-dev liblzma-dev

Install pyenv

download

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

Add the following to ~/.bashrc

export PATH=~/.pyenv/bin:$PATH
export PYENV_ROOT=~/.pyenv
eval "$(pyenv init -)"

Update environment variables

# source ~/.bashrc

Install Python

# pyenv install 3.8.5
Downloading Python-3.8.5.tar.xz...
-> https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz

pyenv may download very slowly. You can copy the displayed download link, download it in the browser, and then put it in the ~/.pyenv/cache/ directory (the cache directory needs to be created manually), and then re-execute pyenv install 3.8.5

Switch Python environment

Query the currently installed Python version

# pyenv versions
* system (set by /home/zpzhou/.pyenv/version)
 3.8.5

Switch version

You can use the command pyenv global <version> to switch.

Before switching:

# python -V
Python 2.7.13

Switch:

# pyenv global 3.8.5

After switching:

# python -V
Python 3.8.5

Summarize

This is the end of this article about installing the artifact Pyenv under Deepin. For more information about installing the artifact Pyenv under Deepin, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to install pyenv under Linux
  • Ubuntu 18.04 installs pyenv, pyenv-virtualenv, virtualenv, Numpy, SciPy, Pillow, Matplotlib
  • Install pyenv and virtualenv to manage multiple versions and projects of Python
  • Tutorial on installation and use of pyenv in Mac

<<:  Examples of correct use of interface and type methods in TypeScript

>>:  Summary of several replication methods for MySQL master-slave replication

Recommend

Detailed explanation of SQL injection - security (Part 2)

If there are any errors in this article or you ha...

A summary of detailed insights on how to import CSS

The development history of CSS will not be introd...

Several ways of running in the background of Linux (summary)

1. nohup Run the program in a way that ignores th...

An example of how to write a big sun weather icon in pure CSS

Effect The effect diagram is as follows Implement...

Life cycle and hook functions in Vue

Table of contents 1. What is the life cycle 2. Th...

Detailed explanation of Windows time server configuration method

Recently, I found that the company's server t...

Analysis of different MySQL table sorting rules error

The following error is reported when MySQL joins ...

Summary of seven MySQL JOIN types

Before we begin, we create two tables to demonstr...

MySQL 8.0.18 deployment and installation tutorial under Windows 7

1. Preliminary preparation (windows7+mysql-8.0.18...

Implementation of Vue package size optimization (from 1.72M to 94K)

1. Background I recently made a website, uidea, w...

CSS transparent border background-clip magic

This article mainly introduces the wonderful use ...

Detailed explanation of using scp command to copy files remotely in Linux

Preface scp is the abbreviation of secure copy. s...

Detailed explanation of webpack-dev-server core concepts and cases

webpack-dev-server core concepts Webpack's Co...

A brief analysis of event bubbling and event capture in js

Table of contents 01-Event Bubbling 1.1- Introduc...