使用pip安装django2:
pip install django
报错:
Collecting django
Using cached Django-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "django/setup.py", line 32, in <module>
version = __import__(‘django‘).get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 61, in <module>
@functools.lru_cache()
AttributeError: ‘module‘ object has no attribute ‘lru_cache‘
原因
这是因为django2.0与Python 2.x不兼容。
lru_cache为Python3.2新增的,而django2.0只支持Python3.4+。
解决方法
对于不兼容问题,解决方法两个:
1、安装django2.0以下的版本,如django 1.11
pip install ‘django<2.0‘
原文地址:https://www.cnblogs.com/my-blogs-for-everone/p/8290124.html