mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Update __init__.py to support symbolic links
Currently, the LOADER_DIR is set as os.path.dirname(os.path.abspath(__file__)). This does not point to the true library path if the cv2 folder is symlinked into the Python package directory such that importing cv2 under Python fails. The proposed change only resolves symbolic links correctly by calling os.path.realpath(__file__) first and does not change anything if __file__ contains no symbolic link.
This commit is contained in:
parent
6f70b0524a
commit
ec32061f5f
@ -34,7 +34,7 @@ def bootstrap():
|
|||||||
import platform
|
import platform
|
||||||
if DEBUG: print('OpenCV loader: os.name="{}" platform.system()="{}"'.format(os.name, str(platform.system())))
|
if DEBUG: print('OpenCV loader: os.name="{}" platform.system()="{}"'.format(os.name, str(platform.system())))
|
||||||
|
|
||||||
LOADER_DIR=os.path.dirname(os.path.abspath(__file__))
|
LOADER_DIR = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
|
||||||
|
|
||||||
PYTHON_EXTENSIONS_PATHS = []
|
PYTHON_EXTENSIONS_PATHS = []
|
||||||
BINARIES_PATHS = []
|
BINARIES_PATHS = []
|
||||||
|
Loading…
Reference in New Issue
Block a user