ERROR: Could not install packages due to an EnvironmentError: [WinError 145] 目录不是空的。: 'D:\Python\Python\venv\Lib\site-packages\~jango\contrib\postgres\locale\fr'

在安装django过滤插件时报错,如下:

(venv) D:python_learn
estfullearnRESTAPI>pip install django-filter
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting django-filter
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/35/94/e516d7f41adecb9fd280c89feceb98fa58f6966a583035c8016ed455c4e5/django_filter-2.3.0-py3-none-any.whl (73 kB)
     |████████████████████████████████| 73 kB 418 kB/s
Collecting Django>=2.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2b/5a/4bd5624546912082a1bd2709d0edc0685f5c7827a278d806a20cf6adea28/Django-3.1-py3-none-any.whl (7.8 MB)
     |████████████████████████████████| 7.8 MB 504 kB/s
Collecting asgiref~=3.2.10
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d5/eb/64725b25f991010307fd18a9e0c1f0e6dff2f03622fc4bcbcdb2244f60d6/asgiref-3.2.10-py3-none-any.whl (19 kB)
Requirement already satisfied: pytz in d:pythonpythonvenvlibsite-packages (from Django>=2.2->django-filter) (2020.1)
Collecting sqlparse>=0.2.2
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/85/ee/6e821932f413a5c4b76be9c5936e313e4fc626b33f16e027866e1d60f588/sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
     |████████████████████████████████| 40 kB 1.3 MB/s
Installing collected packages: asgiref, sqlparse, Django, django-filter
  Attempting uninstall: Django
    Found existing installation: Django 1.11.11
    Uninstalling Django-1.11.11:
      Successfully uninstalled Django-1.11.11
ERROR: Could not install packages due to an EnvironmentError: [WinError 145] 目录不是空的。: 'D:\Python\Python\venv\Lib\site-packages\~jango\contrib\postgres\locale\fr'

 问题解决:

原因:未指定django-filter版本,导致安装最新版本的django-filter时django自动升级,后出现报错情况,将django版本回退,安装对应版本的django-filter==1.1.0;

不再报错

原文地址:https://www.cnblogs.com/sewen-H/p/13435035.html