基于cx_freeze编译PyQt4程序(numpy & scipy)
当开发完成PyQt4程序后,需要提供给他人使用,这时最好的办法是将Python程序编译成exe文件。
通常我采用cx_freeze完成这个工作,即编写setup.py文件,执行python setup.py build即可。
(1) 对于一般的PyQt4程序,setup.py内容如下:
import sys from cx_Freeze import setup, Executable base = None
if sys.platform == 'win32':
base = 'Win32GUI' options = {
'build_exe': {
'includes': ['atexit'],
'excludes': ['Tkinter',
'collections.sys',
'collections._weakref']
}
} setup(
name="程序名",
version="版本号",
description="",
options=options,
executables=[Executable("主程序绝对路径", base=base,
icon="图标绝对路径")])
(2) 当使用numpy后,则setup.py修改为:
import sys from cx_Freeze import setup, Executable base = None
if sys.platform == 'win32':
base = 'Win32GUI' options = {
'build_exe': {
'includes': ['atexit',
'numpy'],
'excludes': ['Tkinter',
'collections.sys',
'collections._weakref']
}
} setup(
name="程序名",
version="版本号",
description="",
options=options,
executables=[Executable("主程序绝对路径", base=base,
icon="图标绝对路径")])
(3) 当使用scipy后,利用cx_freeze编译时会出现Import Error: No module named 'scipy'。
这时需要将cx_Freeze文件夹下的hooks.py的第548行代码"finder.IncludePackage("scipy.lib")"改为"finder.IncludePackage("scipy._lib")"。
相应的setup.py修改如下:
import sys
import numpy # 一定要有,否则会出现_ufuncs错误 from cx_Freeze import setup, Executable base = None
if sys.platform == 'win32':
base = 'Win32GUI' options = {
'build_exe': {
'packages': ['scipy'], # 重要
'includes': ['atexit',
'numpy',
'scipy'],
'excludes': ['Tkinter',
'collections.sys',
'collections._weakref']
}
} setup(
name="程序名",
version="版本号",
description="",
options=options,
executables=[Executable("主程序绝对路径", base=base,
icon="图标绝对路径")])
基于cx_freeze编译PyQt4程序(numpy & scipy)的更多相关文章
- [python] 安装numpy+scipy+matlotlib+scikit-learn及问题解决
这篇文章主要讲述Python如何安装Numpy.Scipy.Matlotlib.Scikit-learn等库的过程及遇到的问题解决方法.最近安装这个真是一把泪啊,各种不兼容问题和报错,希望文章对你有所 ...
- numpy+scipy+matlotlib+scikit-learn的安装及问题解决
NumPy(Numeric Python)系统是Python的一种开源的数值计算扩展,一个用python实现的科学计算包.它提供了许多高级的数值编程工具,如:矩阵数据类型.矢量处理,以及精密的运算库. ...
- windows下安装python numpy+scipy+matlotlib+scikit-learn等流行库
(1)请不要直接使用 pip install scikit-learn pip install Numpy pip install Scipy pip install Matplotlib 命令安 ...
- matplotlib numpy scipy 的安装
一:windows 端的安装 #cmd指令 python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sym ...
- 基于DevExpress的Winform程序安装包的制作
在我们做系统开发的时候,都会面临一个安装包制作的问题,如何把我们做好的系统,通过安装包工具整合成一个安装包给客户进行安装.安装包的优势就是一步步安装就可以了,不用复制一大堆文件给客户,还怕缺少那个文件 ...
- windows下安装python科学计算环境,numpy scipy scikit ,matplotlib等
安装matplotlib: pip install matplotlib 背景: 目的:要用Python下的DBSCAN聚类算法. scikit-learn 是一个基于SciPy和Numpy的开源机器 ...
- linux python 安装 nose lapack atlas numpy scipy
linux python 安装 nose lapack atlas numpy scipy --http://lib.csdn.net/article/python/1262 作者:maple1149 ...
- ok6410[002] ubuntu1604系统下搭配ckermit和dnw基于RAM的裸机程序调试环境
ubuntu1604系统下搭配ckermit和dnw基于RAM的裸机程序调试环境 系统: ubuntu16.04 裸板: 飞凌公司OK6410开发板 目标:搭建基于ubuntu1604系统和基于RA ...
- 如何在VS2010的VC++ 基于对话框的MFC程序中添加菜单
方法1:亲测 成功 转载自https://social.msdn.microsoft.com/Forums/vstudio/zh-CN/48338f6b-e5d9-4c0c-8b17-05ca3ef ...
随机推荐
- poj 1564 Sum It Up【dfs+去重】
Sum It Up Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 6682 Accepted: 3475 Descrip ...
- SharePoint 2013的100个新功能之网站管理(二)
一:SharePoint 2013的网站策略 网站策略指的是自动关闭或删除网站的条件.有四个选项:不自动关闭或删除网站.自动删除网站.自动关闭并删除网站和运行一个工作流来关闭.删除网站. 二:新的主题 ...
- MySQL基本配置
>>添加环境变量 把MySQL Server的bin目录添加到系统path中. >>MySQL启动和停止命令 net start mysql56 net stop mysql5 ...
- HTTP协议的特点
HTTP协议的主要特点可概括如下: 1.支持客户/服务器模式.2.简单快速:客户向服务器请求服务时,只需传送请求方法和路径.请求方法常用的有GET.HEAD.POST.每种方法规定了客户与服务器联系的 ...
- Java生成缩略图Thumbnailator(转载)
转自(http://rensanning.iteye.com/blog/1545708) Thumbnailator 是一个为Java界面更流畅的缩略图生成库.从API提供现有的图像文件和图像对象的缩 ...
- JDBC基本知识
JDBC的作用 JDBC为java访问数据库提供通用的API,可以为多种关系数据库提供统一访问.因为SQL是关系式数据库管理系统的标准语言,只要我们遵循SQL规范,那么我们写的代码既可以访问MySQL ...
- Python爬取CSDN博客文章
0 url :http://blog.csdn.net/youyou1543724847/article/details/52818339Redis一点基础的东西目录 1.基础底层数据结构 2.win ...
- mac下修改mysql的默认字符集为utf8
1,检查默认安装的mysql的字符集 mysql> show variables like '%char%'; +--------------------------+------------- ...
- android uri , file , string 互转
1:android Uri 介绍 http://www.cnblogs.com/lingyun1120/archive/2012/04/18/2455212.html 2:File 转成Uri < ...
- [PWA] Enable Push Notification in your web app
1. Clone the project: git clone https://github.com/GoogleChrome/push-notifications.git 2. install th ...