Use python3 to install third on ubuntu

  1. Problem discovery

Use jenkins to manage my python code, because the python3.5 version is used, first use virtualenv on ubuntu to generate a python3.5 virtual operating environment

virtualenv -p /usr/bin/python3.5 --no-site-packages python3.5

The virtualenv command is to create an "independent" runtime environment for python, because when there are multiple versions of our system, and when 2 and 3 are completely incompatible, at this time we need an independent for each version Operating environment

Let's check what's in this directory

This contains our complete python operating environment, and then the python variable and pip variable are defined on jenkins

Then we created a job. In this job, we use git to pull our code. The code address is on github. After the pull is completed, we set the shell operation to be executed in our custom Execute shell. Prompt that the library psutil needs to be installed, so in the system

pip install psutil

Show that the installation is successful, and then rebuild, through the console output, it is still prompted that there is no psutil library

Second, the problem conjecture

  1. I guess that this may be the successful installation on python2. It reads the path from the python2 library, and the pip used is also version 2, so I use the ××× of this package to unzip, and use python3 in the virtual environment .5

python3.5 setup.py build

The result shows that the x86_64-linux-gnu-gcc command does not exist, but this command does exist in the system, so I suspect that the virtualenv environment may not be common to the outside environment

  1. Using the python3.5 installation that comes with the system, it still shows that the x86_64-linux-gnu-gcc command does not exist. Checking through the jenkins console output window shows that a file in psutil does not have the header file Python.h, and Baidu shows python The development kit does not exist, and finally found the answer to the question.

Three, solve the problem

Because python3 is used in the file, the development package of python3 should be used, so install his development package

sudo  apt-get install python3-dev

sudo apt-get upgrade

Then use in the psutil package

python3.5 setup.py build

python3.5 setup.py install

Solve the problem completely.

Recommended Posts

Use python3 to install third on ubuntu
How to install Python 3.8 on Ubuntu 18.04
Install Python3 on Ubuntu 14.04
Install Python3 on Ubuntu 16.04
Install Python3.7 on Ubuntu
How to install Python2 on Ubuntu20.04 ubuntu/focal64
Install Python 3.7 on Ubuntu 18.04 LTS
How to install and use Curl on Ubuntu 18.04
How to install and use Composer on Ubuntu 18.04
How to install and use Wine on Ubuntu 18.04
How to install and use Composer on Ubuntu 20.04
[Practice] How to install python3.6 on Ubuntu system
How to install and use PostgreSQL on Ubuntu 16.04
How to install and use Docker on Ubuntu 16.04
How to install and use MySQL Workbench on Ubuntu 18.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install Go on Ubuntu 20.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on CentOS 8
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to install Teamviewer on Ubuntu 16.04
Install Python virtual environment on Ubuntu 18.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Go on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
Install TensorFlow (python2.7 version) on Ubuntu
How to install Nginx on Ubuntu 16.04
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04