当前位置:   article > 正文

彻底解决python的pip install xxx报错(文末附所有依赖文件)

彻底解决python的pip install xxx报错(文末附所有依赖文件)

今天安装pip install django又报错了:

C:\Users\Administrator>pip install django
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting django
  ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages
/a1/b9/5adf3f78e4c7b762eb6f1140057bd128c978c3f85c08e412f951aef65f9e/Django-4.2.1
1-py3-none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/django/) (requ
ires-python:>=3.8)
ERROR: Could not install requirement django from https://pypi.tuna.tsinghua.edu.
cn/packages/a1/b9/5adf3f78e4c7b762eb6f1140057bd128c978c3f85c08e412f951aef65f9e/D
jango-4.2.11-py3-none-any.whl because of HTTP error 403 Client Error: Forbidden
for url: https://pypi.tuna.tsinghua.edu.cn/packages/a1/b9/5adf3f78e4c7b762eb6f11
40057bd128c978c3f85c08e412f951aef65f9e/Django-4.2.11-py3-none-any.whl for URL ht
tps://pypi.tuna.tsinghua.edu.cn/packages/a1/b9/5adf3f78e4c7b762eb6f1140057bd128c
978c3f85c08e412f951aef65f9e/Django-4.2.11-py3-none-any.whl (from https://pypi.tu
na.tsinghua.edu.cn/simple/django/) (requires-python:>=3.8)

403错误,https://pypi.tuna.tsinghua.edu.cn/simple又拒绝我访问了,还是离线安装比较靠谱。

 

首先到PyPI · The Python Package Index搜索Django

188e891fa15147229cb6d370b13d9a9e.png

查询结果如下

8c28808e208d4182a320f51d8b763f2d.png Django 5.0.5,这个应该是最新版的,点进去看详细

36641fc8bfac434a8cbbc0b1ea86f301.png

从右上角的Latest version,知道5.0.5是最新版的, 不过我们不需要最新版的,从控制台报错得知,我们只需要这个版本:Django-4.2.11-py3-none-any.whl

 那我们点击左侧的Release history

e38332a24897439f8de39cf82dc085b2.png

找到4.2.11版本

 6f3666b19098413c8556741e22caf850.png

点进去看详情

9aa6e7a015aa4b7fbb5bd8004e37e1c0.png

然后点击Download files进行下载

2a429076fce84b8e9eeef18e899f0a4f.png

这时,会跳出一个选择下载文件画面,一个是源码包文件,一个是编译好的文件,根据控制台的提示,我们直接选择编译好的Django-4.2.11-py3-none-any.whl下载即可,下载速度可能会非常慢,请大家忍一忍。

 下载好的文件名是Django-4.2.11-py3-none-any.whl

 我们直接用命令行进入到这个文件所在的路径,然后使用以下命令进行安装:

pip install Django-4.2.11-py3-none-any.whl

不过还是报错了

C:\Users\Administrator>cd C:\Users\Administrator\Desktop

C:\Users\Administrator\Desktop>pip install Django-4.2.11-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\django-4.2.11-py3-none-any.whl
Collecting asgiref<4,>=3.6.0 (from Django==4.2.11)
  ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages
/39/e3/893e8757be2612e6c266d9bb58ad2e3651524b5b40cf56761e985a28b13e/asgiref-3.8.
1-py3-none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/asgiref/) (req
uires-python:>=3.8)

ERROR: Could not install requirement asgiref<4,>=3.6.0 from https://pypi.tuna.ts
inghua.edu.cn/packages/39/e3/893e8757be2612e6c266d9bb58ad2e3651524b5b40cf56761e9
85a28b13e/asgiref-3.8.1-py3-none-any.whl (from Django==4.2.11) because of HTTP e
rror 403 Client Error: Forbidden for url: https://pypi.tuna.tsinghua.edu.cn/pack
ages/39/e3/893e8757be2612e6c266d9bb58ad2e3651524b5b40cf56761e985a28b13e/asgiref-
3.8.1-py3-none-any.whl for URL https://pypi.tuna.tsinghua.edu.cn/packages/39/e3/
893e8757be2612e6c266d9bb58ad2e3651524b5b40cf56761e985a28b13e/asgiref-3.8.1-py3-n
one-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/asgiref/) (requires-p
ython:>=3.8)

 缺少依赖包:asgiref-3.8.1-py3-none-any.whl

 按照下载Django的方法,再下载asgiref-3.8.1-py3-none-any.whl进行安装

很幸运,直接搜出来就是3.8.1版本

92caa4b9ba02403eb9a052cf13c5cbaa.png

下载好asgiref-3.8.1-py3-none-any.whl后,直接安装,成功

C:\Users\Administrator\Desktop>pip install asgiref-3.8.1-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\asgiref-3.8.1-py3-none-any.whl
Requirement already satisfied: typing-extensions>=4 in d:\soft\python\python38\l
ib\site-packages (from asgiref==3.8.1) (4.11.0)
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Installing collected packages: asgiref
Successfully installed asgiref-3.8.1 

继续安装Django,又出现一个报错

C:\Users\Administrator\Desktop>pip install Django-4.2.11-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\django-4.2.11-py3-none-any.whl
Requirement already satisfied: asgiref<4,>=3.6.0 in d:\soft\python\python38\lib\
site-packages (from Django==4.2.11) (3.8.1)
Collecting sqlparse>=0.3.1 (from Django==4.2.11)
  ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages
/43/5d/a0fdd88fd486b39ae1fd1a75ff75b4e29a0df96c0304d462fd407b82efe0/sqlparse-0.5
.0-py3-none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/sqlparse/) (r
equires-python:>=3.8)
ERROR: Could not install requirement sqlparse>=0.3.1 from https://pypi.tuna.tsin
ghua.edu.cn/packages/43/5d/a0fdd88fd486b39ae1fd1a75ff75b4e29a0df96c0304d462fd407
b82efe0/sqlparse-0.5.0-py3-none-any.whl (from Django==4.2.11) because of HTTP er
ror 403 Client Error: Forbidden for url: https://pypi.tuna.tsinghua.edu.cn/packa
ges/43/5d/a0fdd88fd486b39ae1fd1a75ff75b4e29a0df96c0304d462fd407b82efe0/sqlparse-
0.5.0-py3-none-any.whl for URL https://pypi.tuna.tsinghua.edu.cn/packages/43/5d/
a0fdd88fd486b39ae1fd1a75ff75b4e29a0df96c0304d462fd407b82efe0/sqlparse-0.5.0-py3-
none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/sqlparse/) (requires
-python:>=3.8)

 继续下载安装sqlparse-0.5.0-py3-none-any.whl

C:\Users\Administrator\Desktop>pip install sqlparse-0.5.0-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\sqlparse-0.5.0-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Installing collected packages: sqlparse
Successfully installed sqlparse-0.5.0

 又缺少一个包backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl

C:\Users\Administrator\Desktop>pip install Django-4.2.11-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\django-4.2.11-py3-none-any.whl
Requirement already satisfied: asgiref<4,>=3.6.0 in d:\soft\python\python38\lib\
site-packages (from Django==4.2.11) (3.8.1)
Requirement already satisfied: sqlparse>=0.3.1 in d:\soft\python\python38\lib\si
te-packages (from Django==4.2.11) (0.5.0)
Collecting backports.zoneinfo (from Django==4.2.11)
  ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages
/78/cc/e27fd6493bbce8dbea7e6c1bc861fe3d3bc22c4f7c81f4c3befb8ff5bfaf/backports.zo
neinfo-0.2.1-cp38-cp38-win_amd64.whl#sha256=4a0f800587060bf8880f954dbef70de6c11b
be59c673c3d818921f042f9954a6 (from https://pypi.tuna.tsinghua.edu.cn/simple/back
ports-zoneinfo/) (requires-python:>=3.6)
ERROR: Could not install requirement backports.zoneinfo from https://pypi.tuna.t
singhua.edu.cn/packages/78/cc/e27fd6493bbce8dbea7e6c1bc861fe3d3bc22c4f7c81f4c3be
fb8ff5bfaf/backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl#sha256=4a0f800587060
bf8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6 (from Django==4.2.11) becaus
e of HTTP error 403 Client Error: Forbidden for url: https://pypi.tuna.tsinghua.
edu.cn/packages/78/cc/e27fd6493bbce8dbea7e6c1bc861fe3d3bc22c4f7c81f4c3befb8ff5bf
af/backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl for URL https://pypi.tuna.ts
inghua.edu.cn/packages/78/cc/e27fd6493bbce8dbea7e6c1bc861fe3d3bc22c4f7c81f4c3bef
b8ff5bfaf/backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl#sha256=4a0f800587060b
f8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6 (from https://pypi.tuna.tsing
hua.edu.cn/simple/backports-zoneinfo/) (requires-python:>=3.6)

下载安装backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl

C:\Users\Administrator\Desktop>pip install backports.zoneinfo-0.2.1-cp38-cp38-wi
n_amd64.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\backports.zoneinfo-0.2.1-cp38-cp38-win
_amd64.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Installing collected packages: backports.zoneinfo
Successfully installed backports.zoneinfo-0.2.1

 继续安装,又有一个依赖tzdata-2024.1-py2.py3-none-any.whl

C:\Users\Administrator\Desktop>pip install Django-4.2.11-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\django-4.2.11-py3-none-any.whl
Requirement already satisfied: asgiref<4,>=3.6.0 in d:\soft\python\python38\lib\
site-packages (from Django==4.2.11) (3.8.1)
Requirement already satisfied: sqlparse>=0.3.1 in d:\soft\python\python38\lib\si
te-packages (from Django==4.2.11) (0.5.0)
Requirement already satisfied: backports.zoneinfo in d:\soft\python\python38\lib
\site-packages (from Django==4.2.11) (0.2.1)
Collecting tzdata (from Django==4.2.11)
  ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages
/65/58/f9c9e6be752e9fcb8b6a0ee9fb87e6e7a1f6bcab2cdc73f02bb7ba91ada0/tzdata-2024.
1-py2.py3-none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/tzdata/) (
requires-python:>=2)
ERROR: Could not install requirement tzdata from https://pypi.tuna.tsinghua.edu.
cn/packages/65/58/f9c9e6be752e9fcb8b6a0ee9fb87e6e7a1f6bcab2cdc73f02bb7ba91ada0/t
zdata-2024.1-py2.py3-none-any.whl (from Django==4.2.11) because of HTTP error 40
3 Client Error: Forbidden for url: https://pypi.tuna.tsinghua.edu.cn/packages/65
/58/f9c9e6be752e9fcb8b6a0ee9fb87e6e7a1f6bcab2cdc73f02bb7ba91ada0/tzdata-2024.1-p
y2.py3-none-any.whl for URL https://pypi.tuna.tsinghua.edu.cn/packages/65/58/f9c
9e6be752e9fcb8b6a0ee9fb87e6e7a1f6bcab2cdc73f02bb7ba91ada0/tzdata-2024.1-py2.py3-
none-any.whl (from https://pypi.tuna.tsinghua.edu.cn/simple/tzdata/) (requires-p
ython:>=2)

继续下载安装tzdata-2024.1-py2.py3-none-any.whl

C:\Users\Administrator\Desktop>pip install tzdata-2024.1-py2.py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\tzdata-2024.1-py2.py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Installing collected packages: tzdata
Successfully installed tzdata-2024.1 

 终于安装成功

C:\Users\Administrator\Desktop>pip install Django-4.2.11-py3-none-any.whl
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing c:\users\administrator\desktop\django-4.2.11-py3-none-any.whl
Requirement already satisfied: asgiref<4,>=3.6.0 in d:\soft\python\python38\lib\
site-packages (from Django==4.2.11) (3.8.1)
Requirement already satisfied: sqlparse>=0.3.1 in d:\soft\python\python38\lib\si
te-packages (from Django==4.2.11) (0.5.0)
Requirement already satisfied: backports.zoneinfo in d:\soft\python\python38\lib
\site-packages (from Django==4.2.11) (0.2.1)
Requirement already satisfied: tzdata in d:\soft\python\python38\lib\site-packag
es (from Django==4.2.11) (2024.1)
Requirement already satisfied: typing-extensions>=4 in d:\soft\python\python38\l
ib\site-packages (from asgiref<4,>=3.6.0->Django==4.2.11) (4.11.0)
WARNING: Ignoring invalid distribution -ip (d:\soft\python\python38\lib\site-pac
kages)
Installing collected packages: Django
Successfully installed Django-4.2.11

文中的asgiref-3.8.1-py3-none-any.whl、sqlparse-0.5.0-py3-none-any.whl、backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl、tzdata-2024.1-py2.py3-none-any.whl、Django-4.2.11-py3-none-any.whl可以在下面的链接进行下载

https://download.csdn.net/download/svygh123/89276450

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/559863
推荐阅读
相关标签
  

闽ICP备14008679号