Ошибка упаковки py2app при включении pip-модулей - PullRequest
0 голосов
/ 10 сентября 2018

Я получаю следующую ошибку при попытке включить модули pip при компиляции с использованием py2app:

running py2app
creating /Users/gryphon/Desktop/py2app test/build
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app/collect
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app/temp
creating /Users/gryphon/Desktop/py2app test/dist
creating build/bdist.macosx-10.6-intel/python3.6-standalone/app/lib-dynload
creating build/bdist.macosx-10.6-intel/python3.6-standalone/app/Frameworks
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    setup_requires=['py2app'],
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 838, in run
    self._run()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 1053, in _run
    self.run_normal()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 1146, in run_normal
    mf = self.get_modulefinder()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 997, in get_modulefinder
    debug=debug,
  File "/Users/gryphon/Desktop/py2app test/.eggs/modulegraph-0.17-py3.6.egg/modulegraph/find_modules.py", line 338, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/Users/gryphon/Desktop/py2app test/.eggs/modulegraph-0.17-py3.6.egg/modulegraph/find_modules.py", line 256, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object is not subscriptable
Ethans-MacBook-Pro:py2app test gryphon$ clear

Ethans-MacBook-Pro:py2app test gryphon$ sudo python3 setup.py py2app
Password:
running py2app
creating /Users/gryphon/Desktop/py2app test/build
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app/collect
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app/temp
creating /Users/gryphon/Desktop/py2app test/dist
creating build/bdist.macosx-10.6-intel/python3.6-standalone/app/lib-dynload
creating build/bdist.macosx-10.6-intel/python3.6-standalone/app/Frameworks
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    setup_requires=['py2app'],
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 838, in run
    self._run()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 1053, in _run
    self.run_normal()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 1146, in run_normal
    mf = self.get_modulefinder()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 997, in get_modulefinder
    debug=debug,
  File "/Users/gryphon/Desktop/py2app test/.eggs/modulegraph-0.17-py3.6.egg/modulegraph/find_modules.py", line 338, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/Users/gryphon/Desktop/py2app test/.eggs/modulegraph-0.17-py3.6.egg/modulegraph/find_modules.py", line 256, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object is not subscriptable
Ethans-MacBook-Pro:py2app test gryphon$ cls
-bash: cls: command not found
Ethans-MacBook-Pro:py2app test gryphon$ clear

Ethans-MacBook-Pro:py2app test gryphon$ sudo python3 setup.py py2app
Password:
running py2app
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app/collect
creating /Users/gryphon/Desktop/py2app test/build/bdist.macosx-10.6-intel/python3.6-standalone/app/temp
creating build/bdist.macosx-10.6-intel/python3.6-standalone/app/lib-dynload
creating build/bdist.macosx-10.6-intel/python3.6-standalone/app/Frameworks
Traceback (most recent call last):
  File "setup.py", line 9, in <module>
    setup_requires=['py2app'],
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
    return distutils.core.setup(**attrs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 838, in run
    self._run()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 1053, in _run
    self.run_normal()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 1146, in run_normal
    mf = self.get_modulefinder()
  File "/Users/gryphon/Desktop/py2app test/.eggs/py2app-0.17-py3.6.egg/py2app/build_app.py", line 997, in get_modulefinder
    debug=debug,
  File "/Users/gryphon/Desktop/py2app test/.eggs/modulegraph-0.17-py3.6.egg/modulegraph/find_modules.py", line 338, in find_modules
    find_needed_modules(mf, scripts, includes, packages)
  File "/Users/gryphon/Desktop/py2app test/.eggs/modulegraph-0.17-py3.6.egg/modulegraph/find_modules.py", line 256, in find_needed_modules
    path = m.packagepath[0]
TypeError: 'NoneType' object is not subscriptable

Мой setup.py:

from setuptools import setup

APP = ['test.py']
OPTIONS = {'argv_emulation': True, "packages": ["requests"]}

setup(
    app=APP,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

Test.py:

import requests

requests.get("https://www.youtube.com")

print("Hello")

При использовании только ввода (удаление запросов) все работает нормально, однако всякий раз, когда я пытаюсь включить модули pip, я получаю сообщение об ошибке. Если я не включаю pip-модули в setup.py, я получаю сообщение о том, что их невозможно найти. Я попытался добавить флаг --packages = запросы после py2app, я получил ту же ошибку.

...