Python公文包Django:设置.py返回非零退出状态1

2024-05-20 20:59:42 发布

您现在位置:Python中文网/ 问答频道 /正文

  • Ubuntu 18.04 LTS
  • Python 3.6
  • 节点8.11.4(LTS)
  • 净现值5.6.0

尝试按照公文包教程中的instructions安装教程django项目。它可以很好地安装Linux文件,但是尝试以相同的方式安装它,但是使用djangopython3 setup.py django -s会导致以下失败:

running django

 * Updating user code...
 * Installing requirements...
No requirements.
 * Installing plaform requirements...
Collecting toga-django==0.3.0.dev9
  Using cached https://files.pythonhosted.org/packages/9e/88/49d9ab4c128e61a47bb365201fdfa3ebf1fd8905c0c5baa06dc248db9f0a/toga_django-0.3.0.dev9-py3-none-any.whl
Collecting toga-core==0.3.0.dev9 (from toga-django==0.3.0.dev9)
  Using cached https://files.pythonhosted.org/packages/50/a1/ebc3b57145b03b644cc53c2693838eb3afafdb686eec2dffd90cf3548d09/toga_core-0.3.0.dev9-py3-none-any.whl
Collecting django-environ==0.4.1 (from toga-django==0.3.0.dev9)
  Using cached https://files.pythonhosted.org/packages/f4/06/8dd165534eae19e72ca78bd6e845566cd1e0aacc9c20cc43984675748345/django_environ-0.4.1-py2.py3-none-any.whl
Collecting django==1.10.6 (from toga-django==0.3.0.dev9)
  Using cached https://files.pythonhosted.org/packages/b9/bb/723f78e6f6aea78590331eba4e42b8a09c33ce154204a942525a91101d0b/Django-1.10.6-py2.py3-none-any.whl
Collecting travertino>=0.1.0 (from toga-core==0.3.0.dev9->toga-django==0.3.0.dev9)
  Using cached https://files.pythonhosted.org/packages/56/3f/f03efe63c2bdc72763ac39777c9ebbab98605ced5c74aefe48b4fa0abb4d/travertino-0.1.2-py3-none-any.whl
Collecting six (from django-environ==0.4.1->toga-django==0.3.0.dev9)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: travertino, toga-core, django, six, django-environ, toga-django
  Found existing installation: travertino 0.1.2
    Uninstalling travertino-0.1.2:
      Successfully uninstalled travertino-0.1.2
  Found existing installation: toga-core 0.3.0.dev9
    Uninstalling toga-core-0.3.0.dev9:
      Successfully uninstalled toga-core-0.3.0.dev9
  Found existing installation: Django 1.10.6
    Uninstalling Django-1.10.6:
      Successfully uninstalled Django-1.10.6
  Found existing installation: six 1.11.0
    Uninstalling six-1.11.0:
      Successfully uninstalled six-1.11.0
  Found existing installation: django-environ 0.4.1
    Uninstalling django-environ-0.4.1:
      Successfully uninstalled django-environ-0.4.1
  Found existing installation: toga-django 0.3.0.dev9
    Uninstalling toga-django-0.3.0.dev9:
      Successfully uninstalled toga-django-0.3.0.dev9
Successfully installed django-1.10.6 django-environ-0.4.1 six-1.11.0 toga-core-0.3.0.dev9 toga-django-0.3.0.dev9 travertino-0.1.2
 * Installing project code...
Traceback (most recent call last):
  File "setup.py", line 79, in <module>
    'toga-django==0.3.0.dev9',
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 140, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/briefcase/app.py", line 478, in run
    self.install_code()
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/briefcase/app.py", line 314, in install_code
    stderr=subprocess.STDOUT,
  File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pip', 'install', '--upgrade', '--force-reinstall', '--no-dependencies', '--target=/home/hv/Projects/tutorial/helloworld/django', '.']' returned non-zero exit status 1.

我尝试过四处搜索,甚至直接用pip install --upgrade --force-reinstall --no-dependencies --target=/home/hv/Projects/tutorial/helloworld/django .运行pip命令,其输出:

^{pr2}$

我对这件事很陌生,正在寻求一些建议。这是在virtualenv中的版本: pip 18.0 from /home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/pip (python 3.6)

更新: 删除了对toga-django==0.3.0.dev9的特定要求设置.py文件,并且它似乎已成功安装。但是,它不能实际启动Django服务器: python设置.pydjango-s-v型

running django

 * Updating user code...
 * Installing requirements...
No requirements.
 * Installing plaform requirements...
No platform requirements.
 * Installing project code...
Processing /home/hv/Projects/tutorial/helloworld
Installing collected packages: helloworld
  Running setup.py install for helloworld: started
    Running setup.py install for helloworld: finished with status 'done'
Successfully installed helloworld-0.0.1

 * No icons defined - using default...
 * No splash screen defined...
 * Installing NPM requirements...
/usr/bin/env: ‘node’: Not a directory

Installation complete.
 * Building Webpack assets...
/usr/bin/env: ‘node’: Not a directory
 * Starting Django server on localhost:8042
 * Opening browser...
Traceback (most recent call last):
  File "./manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/hv/Projects/tutorial/venv/lib/python3.6/site-packages/django/apps/config.py", line 116, in create
    mod = import_module(mod_path)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'toga.django'

App started.

Tags: djangoinpycorehometogalibpackages