-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy path__init__.py
More file actions
43 lines (34 loc) · 1.25 KB
/
Copy path__init__.py
File metadata and controls
43 lines (34 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
OpenCV Python bindings
This module provides Python bindings for OpenCV.
Important notes for multiprocessing:
- OpenCV is not fork-safe. Using cv2 functions after fork() can cause
"corrupted double-linked list" errors and memory corruption.
- If you use multiprocessing with fork (the default on Linux/macOS),
either:
1. Use spawn mode: multiprocessing.set_start_method('spawn')
2. Call cv2.setNumThreads(0) in each worker before using cv2
- See: https://github.com/opencv/opencv-python/issues/1166
"""
import os
import sys
import warnings
PYTHON_EXTENSIONS_PATHS = [
LOADER_DIR
] + PYTHON_EXTENSIONS_PATHS
ci_and_not_headless = False
try:
from .version import ci_build, headless
ci_and_not_headless = ci_build and not headless
except:
pass
# the Qt plugin is included currently only in the pre-built wheels
if sys.platform.startswith("linux") and ci_and_not_headless:
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "qt", "plugins"
)
# Qt will throw warning on Linux if fonts are not found
if sys.platform.startswith("linux") and ci_and_not_headless:
os.environ["QT_QPA_FONTDIR"] = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "qt", "fonts"
)