Install third party libraries under Linux for different versions of python

  • 2020-05-10 18:24:54
  • OfStack

The problem background

Many of the current linux distributions have two versions of python installed.

The default version on my machine is python 2.x. In addition, when installing the third side library with easy_install, it is also installed on the 2.x version by default, and it is not possible to install the library with import under the 3.x version.

Environment: Kubuntu 15.04

The solution

Install python3-setuptools and easy_install3, and install pip3

sudo apt-get install python3-setuptools
sudo easy_install3 pip
sudo pip3 install pyserial (pyserial replaced with required third party library)

Test import again in python3.x. Done.

The method is not very simple, this is also in the Internet for a long time, only in 1 foreign Internet user's prompt to complete, I hope you can like


Related articles: