Code: Select all
import sys
sys.path.append("/usr/local/python/2.7")
import cv2
Code: Select all
import sys
sys.path.append("/usr/local/python/2.7")
import cv2
Ok that worked:looo wrote:You can try to add the install-dir to the path:But the proper solution would be to install to a directory which is already in the sys.path eg.: '/usr/local/lib/python2.7/dist-packages'Code: Select all
import sys sys.path.append("/usr/local/python/2.7") import cv2
Code: Select all
import sys
>>> sys.path.append("/usr/local/python/2.7")
>>> import cv2
>>>
Code: Select all
freecadcmd-daily
FreeCAD 0.17, Libs: 0.17R10885 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2017
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##
[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>>
Code: Select all
cmake .. -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages
sudo make install
do the same in FreeCAD:But this didn't:
Code: Select all
import sys
sys.path.append("/usr/local/python/2.7")
import cv2
You closed the thread!looo wrote:No, I really don't know why it installs to a wrong location. Just had a look at the conda-recipe for open-cv:
https://github.com/conda-forge/opencv-f ... ld.sh#L105
maybe you can try to run cmake with this option:ps.:Code: Select all
cmake .. -DPYTHON_PACKAGES_PATH=/usr/local/lib/python2.7/dist-packages sudo make install
do the same in FreeCAD:But this didn't:Code: Select all
import sys sys.path.append("/usr/local/python/2.7") import cv2
Code: Select all
freecadcmd-daily
FreeCAD 0.17, Libs: 0.17R10885 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2017
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##
[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>> import sys
>>> sys.path.append("/usr/local/python/2.7")
>>> import cv2
>>>