"import pyzed.sl as sl" error

I have tried some methods in other topics but have not solved this problem.
I have already installed ZED SDK 4.0.6 and also usedget_python_api.py installed the required whl file.There was no error when I used import pyzed in the conda environment, but there is a red line below when I used import pyzed.sl as sl.

Windows 11
Python 3.8.18
cuda 11.8

Meanwhile, when I installed the required whl file through get_python_api in another conda environment (Python=3.7), there was no problem using “import pyzed. sl as sl”. But due to other needs, I can only use the conda environment in Python version>=3.8.
Windows 11
Python 3.7.16
cuda 11.7

I urgently need to solve this problem,any help would be appreciated.


A red line may be your IDE’s settings badly set. Did you try to run your python script from within your conda env ? What is the output ?

Thank you for your reply. It seems to have solved my problem.
What I was originally confused about was that in my Pycharm, import pyzed. sl can be used normally in the Python 3.7 Conda environment, but in the Python 3.8 Conda environment, there is only pyzed but no sl.

Based on your response, I tested using the following simple code and found that it can output normally in both versions of the Conda environment.

import pyzed.sl as sl

I don’t know why, but the issue seems to be negligible.

1 Like