ImportError: libXrender.so.1: cannot open shared object file: No such file or directory (no sudo permission to solve the problem)

Table of contents

1. Problem description

2. Problem Analysis

3. Problem solving

1. Try to solve it with sudo administrator

2. Without administrator (sudo) privileges, terminal input

summary:


1. Problem description

After installing opencv-python, run the code on the server and report an error, as follows:

2. Problem Analysis

opencv dependency packages are incomplete, and python lacks shared libraries

3. Problem solving

1. Try to solve it with sudo administrator

Use when the current user has sudo privileges :

(It doesn’t have to be installed, just install whichever one is missing if you report an error)

sudo
yum install ksh -y 
yum install libXext.so.6 -y 
yum install libXtst.so.6 –y 
yum install libXt.so.6 -y 
yum install libGLU.so.1 --setopt=protected_multilib=false 
yum install libelf.so.1 -y 
yum install libXrender.so.1 -y 
yum install openmotif -y 
yum install libXp.so.6 -y 
yum install libXrandr.so.2 –y 
yum install *xorg* -y 
yum install libXp -y 
yum install ld-linux.so.2 -y 
yum install libstdc++.so.5 -y 
yum install -y xterm

2. Without administrator (sudo) privileges, terminal input

pip list

Check whether the following three opencv packages are all installed

 If there are missing, complete the three packages , the installation command is as follows:

Install opencv-python:

 pip install opencv-python

 Install opencv-python-headless:

 pip install opencv-python-headless==4.5.4.58

 Install opencv-contrib-python-headless:

 pip install opencv-contrib-python-headless==4.5.4.58

Ensure that all three opencv packages can run the code normally

summary:

Because I don't have administrator rights, and the administrator has no time to modify it recently. Therefore, analyze and use the second method to solve the problem and run the code normally.

Hope this helps with the same error!

Guess you like

Origin blog.csdn.net/M_TDM/article/details/127785968