3

I want to include Anaconda's Python 3.6 in my Qt C++ application. The reason why is that I want to be able to include a neural network in my C++ application, which is written in Python.

I tried to include Python in the following way, which I found online:

INCLUDEPATH += /home/[username]/anaconda3/include/python3.6m

LIBS += -L/home/[username]/anaconda3/lib/ -lpython3.6m

It finds the Python.h header but linking to the Python libraries causes Qt Creator to (apparently) use the Qt libraries of Anaconda and not the ones I downloaded and installed in my home folder.

This is problematic for two reasons:

  • My program needs Qt 5.9.1 and does not compile with Qt 5.6 (Anaconda's version)

  • Even if it compiled with Qt 5.6 there are suddenly errors of missing libraries, see below:

Errors in Qt Creator when trying to include Python 3.6

Is there any way to include Python from Anaconda but tell Qt Creator to use my custom Qt Version?

Florian Blume
  • 3,237
  • 17
  • 37
  • You will encounter numerous runtime errors, meta information which have different sizes in different Qt versions. If you are using Linux use the packages provided by the distribution for Python and Qt and everything works like a charm. If you want to go custom compile both Qt and Python yourself, it also works. Done both – Jens Munk Jun 13 '18 at 16:11

1 Answers1

1

Unknowingly, I had the same problem again with a different application and thus posted a new question because I thought it was a different issue.

I found a solution in the mean time and posted the answer here.

ph_0
  • 617
  • 8
  • 27
Florian Blume
  • 3,237
  • 17
  • 37