Congratulations to our 2022 Qt Champions!

Including custom Python (Anaconda Python) -lpython not found

  • I am attempting to compile a simple QtCreator project, written in C++, and include the non-system python installation.

    Via creator, I have added a new external library (linux only). This adds:

    unix: LIBS += -L$$PWD/../../../anaconda/lib/ -lpython2

    INCLUDEPATH += $$PWD/../../../anaconda/include/python2.7
    DEPENDPATH += $$PWD/../../../anaconda/include/python2.7

    to the .pro file.

    The PATHS are all correct, but I am getting a cannot find -lpython2 error. I see that is linking to, could this be the issue and if so, what is the accepted solution?

    What other issues could be causing the lib not to be found?

    More information:

    python-config --cflags reports
    -I/home/jay/anaconda/include/python2.7 -I/home/jay/anaconda/include/python2.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

    I have tried -lpython2, -lpython, -lpython2.7

  • Lifetime Qt Champion

    hi and welcome to devnet,
    You might be missing the Python Dev package from your distribution.
    What distribution are you running ?

Log in to reply