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

Nginx reverse proxy configuration to remove prefix case tutorial

When using nginx as a reverse proxy, you can simp...

A detailed introduction to Linux system operation levels

Table of contents 1. Introduction to Linux system...

CSS3 animation to achieve the effect of streamer button

In the process of learning CSS3, I found that man...

CentOS 7 method to modify the gateway and configure the IP example

When installing the centos7 version, choose to co...

Linux type version memory disk query command introduction

1. First, let’s have a general introduction to th...

Tips for using top command in Linux

First, let me introduce the meaning of some field...

Introduction to using MySQL commands to create, delete, and query indexes

MySQL database tables can create, view, rebuild a...

A brief discussion on the use and analysis of nofollow tags

Controversy over nofollow There was a dispute bet...

Using vsftp to build an FTP server under Linux (with parameter description)

introduce This chapter mainly introduces the proc...

Example code for implementing 3D Rubik's Cube with CSS

Let's make a simple 3D Rubik's Cube today...

Solution to forgetting mysql database password

You may have set a MySQL password just now, but f...

Three BOM objects in JavaScript

Table of contents 1. Location Object 1. URL 2. Pr...