在没有Anaconda的Qt版本的Qt C ++应用程序中包含Anaconda python 3.6 [英] Include Anaconda python 3.6 in Qt C++ application without Anaconda's Qt version

查看:432
本文介绍了在没有Anaconda的Qt版本的Qt C ++应用程序中包含Anaconda python 3.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的Qt C ++应用程序中包含Anaconda的Python 3.6.原因是我希望能够在用Python编写的C ++应用程序中包含神经网络.

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.

我尝试通过以下方式包含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

它找到Python.h标头,但是链接到Python库会使Qt Creator(显然)使用Anaconda的Qt库,而不是我下载并安装在主文件夹中的Qt库.

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:

  • 我的程序需要Qt 5.9.1,并且不能与Qt 5.6(Anaconda的版本)一起编译

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

即使使用Qt 5.6进行编译,也会突然丢失库,请参见以下内容:

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

是否可以通过Anaconda包含Python,但告诉Qt Creator使用我的自定义Qt版本?

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

推荐答案

不巧的是,我在另一个应用程序上又遇到了同样的问题,因此发布了一个新问题,因为我认为这是一个不同的问题.

Unkonwingly, 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.

这篇关于在没有Anaconda的Qt版本的Qt C ++应用程序中包含Anaconda python 3.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆