简体   繁体   中英

How to link an external library (opencv) for debugging a python ros-package in Visual-Studio-Code

I'm writing a python node in ros-indigo on Ubuntu 14.04 and have to use opencv 3.4.6., but the ros-package opencv3 is based on version 3.1. For building with catkin_make i have this lines in my CMakeList.txt file to link the library only if the node need it because all other nodes are linked to the earlier version and building works without error. But the node doesn't work so I want to debug the python source code with visual-studio-code.

set(CMAKE_PREFIX_PATH "home/scout/install_opencv_3.4.6")
find_package(OpenCV 3.4.6 REQUIRED)
set(OpenCV_INCLUDE_DIRS"/home/scout/install_opencv_3.4.6/include")

So my question is how I have to setup visual-studio-code, or anything else, that the python-debugger use/link the library in my special path and not the standard path? Or is there any other solution I can debug or prepare my python script easily the library will be found?

I found some other questions or answers which mentioned the "launch.json", "settings.json" and "task.json" files but I have no idea how to treat these also not with the guide . Maybe also this can help but i don't know how.

So I hope my question is a little bit understandable, I doesn't mixed up much technical terms and anyone can help me.

You can define a environment variable definitions file that can set PYTHONPATH as appropriately for your needs. And if you use the default naming scheme the debugger will pick the file up (otherwise you can specify an env file in your launch.json ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM