Py2app失败并刮擦 [英] Py2app fails with scrapy

查看:158
本文介绍了Py2app失败并刮擦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果试图创建我的项目的独立版本.我已经能够使用py2app创建安装文件和别名应用程序,而没有任何问题.运行别名应用程序可以正常工作.但是,当创建独立文件时,该应用程序将不再运行.

If been trying to create a standalone version of my project. I've been able to create the setup file and the alias app with py2app with no problems. Running the alias app works without problems. However, when creating the independent file the app does not run any more.

首先,我在打开应用程序时收到的错误如下:

First of all the error i receive upon opening the app is as follows:

File "scrapy/__init__.pyc", line 10, in <module>
File "pkgutil.pyc", line 616, in get_data
File "importlib/util.pyc", line 83, in find_spec
AttributeError: 'NoneType' object has no attribute 'startswith'

第一行指向scrapy模块时,我试图用一个空项目来重新创建问题.

As the first line points to the scrapy module i tried to recreate the problem with an empty project.

正如预期的那样,空项目可以完美运行.该应用程序独立运行,没有任何错误.直到添加了scrapy框架.我制作了这个小脚本来尝试重新创建问题:

As expected the empty project works flawless. The app runs independently without any errors. Until adding the scrapy framework. I made this little script trying to recreate the problem:

import scrapy

if __name__ == '__main__':
    scrapy.Request("http://www.google.com")

使用此文件,我试图再次创建独立的应用程序,并且按预期它崩溃并出现与上述相同的错误.

With this file i tried to create the independent app again, and as expected it crashes with the same error as above.

任何有关此问题的帮助将不胜感激.

Any help regarding this problem will be greatly appreciated.

更新

根据user5214530的建议,我尝试使用pyinstaller和--onefile命令创建独立应用程序.不幸的是,我确实得到了和以前相似的结果.

As suggested by user5214530, I have tried to create the standalone app with pyinstaller and the --onefile command. Sadly, I did get similar results as before.

File "site-packages/scrapy/__init__.py", line 10, in <module>
File "pkgutil.py", line 634, in get_data
File "/Users/.../Test/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 479, in get_data
with open(path, 'rb') as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/mz/rg4w2jjj2zj5rtvnv8lxby2w0000gn/T/_MEIiGJyET/scrapy/VERSION'

您可能会看到,我使用简单的测试脚本尝试了此操作,但其中只有刮擦,并且也失败了.刮y可能有问题吗?

As you may see I tried this with the simple test script with only scrapy in it and it also fails. May it be a problem with scrapy?

推荐答案

我建议您使用--onefile命令代替pyinstaller.

I would suggest you use pyinstaller instead, with --onefile command.

1.)pip install pyinstaller
2.)pyinstaller --onefile script.py

1.) pip install pyinstaller
2.) pyinstaller --onefile script.py

这篇关于Py2app失败并刮擦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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