安装Django 1.9导致的pip错误
pip error caused by installing Django 1.9
看来新的 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,我该怎么做才能恢复我的机器?谢谢
如果删除 python 不适合您,请按照以下步骤操作。
- 删除点 (
sudo apt-get remove python-pip
)
- 删除 Djano 包。
sudo rm -rf /usr/local/lib/python2.7/dist-packages/django/
- 重新安装 python。
sudo apt-get install --reinstall python2.7
(如果你的版本是2.7)
- 重新安装 pip
python get-pip.py
- 重新安装 Django(通常方式)
这看起来像是 Django 1.9 发行说明中提到的 setuptools 问题:https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-setuptools-5-5-x
在 运行ning pip install django
之前尝试 运行 pip install -U pip
看来新的 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,我该怎么做才能恢复我的机器?谢谢
如果删除 python 不适合您,请按照以下步骤操作。
- 删除点 (
sudo apt-get remove python-pip
) - 删除 Djano 包。
sudo rm -rf /usr/local/lib/python2.7/dist-packages/django/
- 重新安装 python。
sudo apt-get install --reinstall python2.7
(如果你的版本是2.7) - 重新安装 pip
python get-pip.py
- 重新安装 Django(通常方式)
这看起来像是 Django 1.9 发行说明中提到的 setuptools 问题:https://docs.djangoproject.com/en/1.9/releases/1.9/#syntaxerror-when-installing-django-setuptools-5-5-x
在 运行ning pip install django
之前尝试 运行 pip install -U pip