and better call that with sudo -u www-data too, because who knows how many pythons are on your system and what virtual environments you might have enabled in your own user login.
I compiled and installed opencv according to this tutorial
And all the steps were done correctly (because I want to use gpu)
I searched a lot about it, but I don’t know how to solve this problem
(opencv_cuda)root@lin:
python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux
import cv2
cv2.version
‘4.8.0’
(opencv_cuda) root@lin:~# sudo -u www-data pip list | grep opencv
WARNING: The directory ‘/var/www/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo’s -H flag.