免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3770 | 回复: 1
打印 上一主题 下一主题

cx_Freeze打包的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-03-18 15:42 |只看该作者 |倒序浏览
linux环境下,可以用cx_Freeze打包cx_Oracle么?
  1. #!/usr/bin/python
  2. import cx_Oracle
  3. db = cx_Oracle.connect(accoun,password,sid)
  4. cursor = db.cursor()
  5. r = cursor.execute('select * from amas_area')
  6. result = r.fetchall()
  7. for i in result:
  8.     print i
复制代码
写了个简单的做测试,直接运行这个可以执行
但是用cx_Freeze打包以后就不能运行了。
  1. Traceback (most recent call last):
  2.   File "/usr/python/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
  3.     exec code in m.__dict__
  4.   File "/home/1.py", line 2, in <module>
  5.     import cx_Oracle
  6.   File "build/bdist.linux-x86_64/egg/cx_Oracle.py", line 7, in <module>
  7.   File "build/bdist.linux-x86_64/egg/cx_Oracle.py", line 4, in __bootstrap__
  8.   File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 936, in resource_filename
  9.   File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 1560, in get_resource_filename
  10. NotImplementedError: resource_filename() only supported for .egg, not .zip
复制代码
是因为cx_Oracle不能打包么?如果想打包该怎么做?

论坛徽章:
0
2 [报告]
发表于 2014-03-22 19:42 |只看该作者
我之前用PyInstaller2.0 打包成功过.mac os.


--------------------

cxfreeze 与PyInstaller 将python打包成单个exe文件


1. 将python脚本转成exe
cxfreeze query_trade.py --target-dir R:\dist

方法2. 使用  PyInstaller
D:\greens\PyInstaller\makespec.py --onefile  query_trade.py
D:\greens\pyinstaller\build.py  query_trade.spec

生产的文件运行时报错:
cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle

方法3. 使用py2exe
失败


p.s. PyInstaller2.0 中
/Users/user/Downloads/pyinstaller-2.0/pyinstaller.py --onefile a.py

只要一步就行了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP