Ubuntu 16.04 安装Django时报错"python setup.py egg_info" failed with error code 1

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/imilano/article/details/79147570

Ubuntu pip安装Django(pip install Django)报错如下:

  InsecurePlatformWarning
  Downloading Django-2.0.tar.gz (8.0MB)
    100% |████████████████████████████████| 8.0MB 55kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-6jkxa3/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'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-6jkxa3/Django/

原因及解决办法如下:

解决办法:升级setuptools
    pip install --upgrade setuptools

安装时可指定setuptools的版本。这个办法对我没用。

2.换一种安装办法:python -m pip install Django

imilano@ubuntu:~/Desktop/Blog$ python -m pip install Django

It worked!!!

参考链接戳我

猜你喜欢

转载自blog.csdn.net/imilano/article/details/79147570