gpt4 book ai didi

python - 安装Django 1.9导致的pip错误

转载 作者:太空宇宙 更新时间:2023-11-04 08:52:05 24 4
gpt4 key购买 nike

似乎新的 django 坏了,导致 pip 出错。我安装了 django 并出现语法错误:

cchilders@main:~/projects$ sudo pip install django
Downloading/unpacking django
Downloading Django-1.9-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded
Installing collected packages: django
Compiling /tmp/pip-build-3WZoMx/django/django/conf/app_template/apps.py ...
File "/tmp/pip-build-3WZoMx/django/django/conf/app_template/apps.py", line 4
class {{ camel_case_app_name }}Config(AppConfig):
^
SyntaxError: invalid syntax

Compiling /tmp/pip-build-3WZoMx/django/django/conf/app_template/models.py ...
File "/tmp/pip-build-3WZoMx/django/django/conf/app_template/models.py", line 1
{{ unicode_literals }}from django.db import models
^
SyntaxError: invalid syntax

Successfully installed django
Cleaning up...

现在pip不行了,我试过卸载新的django,卸载pip,然后重新安装pip,无济于事...

cchilders@main:~/projects$ pip freeze
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/freeze.py", line 74, in run
req = pip.FrozenRequirement.from_dist(dist, dependency_links, find_tags=find_tags)
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 299, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

在/home/cchilders/.pip/pip.log 中存储失败的调试日志

因为我已经删除了 django 1.9,我该怎么做才能恢复我的机器?谢谢

最佳答案

这看起来像 Django 1.9 发行说明中提到的 setuptools 问题:https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-setuptools-5-5-x

在运行 pip install django 之前尝试运行 pip install -U pip

关于python - 安装Django 1.9导致的pip错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34193003/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com