firemail

标题: Qt Creator 整合 python 解释器教程 [打印本页]

作者: Qter    时间: 2018-4-9 18:22
标题: Qt Creator 整合 python 解释器教程
本帖最后由 Qter 于 2018-4-10 09:30 编辑

https://www.cnblogs.com/woxinfeixiang2015/p/8507818.html

目录

1. 前言
2.前提条件
3.步骤
3.1 新建 python文件
3.2 编写 python 代码
3.3 配置 python 解释器
3.4 执行 python file

1. 前言
Python是一种解释型、面向对象、动态数据类型的高级程序设计语言。python 有众多第三方库, 可以方便的快速方法各种应用。

Qt Creator 是用于编译 C++ 代码的 IDE。

2.前提条件
安装 python2.7,安装 Qt Creator。
3.步骤3.1 新建 python文件
打开 Qt Creator -> 文件 -> 新建文件或项目 -> python -> python ->命名为 filetest_python



3.2 编写 python 代码
[backcolor=rgb(245, 245, 245) !important][url=][/url]
#!/usr/bin/env python# -*- coding: utf-8 -*- for i in range(1,10):    print i[backcolor=rgb(245, 245, 245) !important][url=][/url]



3.3 配置 python 解释器
工具 -> 选项 -> 环境 -> 外部工具 -> 添加目录(命名为 python ) -> 添加工具(命名为 python27 ) -> 配置参数.
说明:可以是任何文字;
执行档:python的安装目录;
参数:%{CurrentDocument:FilePath};
工作目录:%{CurrentDocument: Path}.


3.4 执行 python file
单击: 工具 -> 外部 -> python -> python27





欢迎光临 firemail (http://www.firemail.wang:8088/) Powered by Discuz! X3