py2app setup.py使用问题
好的,我正在尝试使用 py2app 为我的项目生成发行版。我仍然不确定我是否掌握了它的窍门。所以我的 setup.py 看起来像这样:
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
import setuptools
PACKAGES = ['sqlalchemy.dialects.sqlite']
MODULES = ['sqlite3']
APP = ['tvb/interfaces/web/run.py']
OPTIONS = {'argv_emulation': True,
'packages': PACKAGES ,
'includes' : MODULES }
DATA_FILES = []
setup(
app=APP,
data_files=DATA_FILES,
packages = setuptools.find_packages(),
include_package_data=True,
options={'py2app': OPTIONS},
setup_requires=['py2app', "pyopengl", "cherrypy", "sqlalchemy", "simplejson",
"formencode", "genshi", "quantities","numpy", "scipy",
"numexpr", "nibabel", "cfflib", "mdp", "apscheduler",
"scikits.learn"]
)
所以我的第一个问题是:我应该在 py2app 的模块中包含什么? py2app 是否知道扫描 setup_requires 中的内容并包含它们,或者我是否需要在 MODULES 中为它们添加一些条目?
另一个问题是,我在尝试运行我的应用程序时遇到:sqlalchemy.exc.ArgumentError:无法确定“sqlite”的方言
。经过大量谷歌搜索后,我只看到对于 py2exe,您需要将 sqlalchemy.dialects.sqlite 作为包包含在内,但它似乎对我不起作用。我在这里错过了什么吗?
最后一个是我在 python setup.py py2app
之前得到一个:格式错误的对象(加载命令 3 cmdsize 不是 8 的倍数)
。这是正常的吗?
问候, 博格丹
Ok so I'm trying to use py2app to generate a distribution for my project. I'm still not sure I get the hang of it tho. So my setup.py looks like this:
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
import setuptools
PACKAGES = ['sqlalchemy.dialects.sqlite']
MODULES = ['sqlite3']
APP = ['tvb/interfaces/web/run.py']
OPTIONS = {'argv_emulation': True,
'packages': PACKAGES ,
'includes' : MODULES }
DATA_FILES = []
setup(
app=APP,
data_files=DATA_FILES,
packages = setuptools.find_packages(),
include_package_data=True,
options={'py2app': OPTIONS},
setup_requires=['py2app', "pyopengl", "cherrypy", "sqlalchemy", "simplejson",
"formencode", "genshi", "quantities","numpy", "scipy",
"numexpr", "nibabel", "cfflib", "mdp", "apscheduler",
"scikits.learn"]
)
So my first question would be: What should I include in my MODULES for py2app here? Does py2app know to scan for the things in setup_requires and include them or do I need to add some entries for them in MODULES ?
Another problem is that I'm getting an: sqlalchemy.exc.ArgumentError: Could not determine dialect for 'sqlite'
when trying to run my app. After lots of googling I only saw that for py2exe you need to include the sqlalchemy.dialects.sqlite
as a package but it doesn't seem to work for me. Am I missing something here?
The last one is that I'm getting a: malformed object (load command 3 cmdsize not a multiple of 8)
just before the python setup.py py2app
. Is this normal?
Regards,
Bogdan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来我把整件事都搞错了。
而不是包裹,这似乎已经成功了。
Well seems I got the whole thing wrong.
Instead of packages, and that seems to have done the trick.
这是包含 sqlite 数据库文件的 .py progs 的示例 setup.py。这是适合初学者的示例 setup.py 文件。
如果 your.db 与 your_prog.py 位于同一目录中,则可以使用此配置。 Macos 应用程序将正常工作。如果不指定 .db 文件,应用程序将运行,但无法连接到数据库文件。
This is the sample setup.py for the .py progs that includes sqlite database file. This is the sample setup.py file for beginers.
if your.db in same directory of your_prog.py you can use this configuration. Macos app will work normally as it is. If do not specify the .db file, app will work but couldn't connect to database file.