在服务器上安装pytorch时,在线安装一直报错,因为访问国外的网,管的这么严,太难了我。然后网上说换源安装,换源了也不行,估计是还得删除原来的源,然后百度了好多案例,删了-c什么的都不行,还是报错,给我整崩溃了。然后就开始尝试离线的,在网上下载whl文件,然后用pip命令本地安装,以为可以了,结果还tm报错,服了啊。3
网上的方法是cd到目录文件下,然后直接pip install .whl(这是文件名哈),结果还是报错ERROR: torch-1.7.1+cu110-cp37-cp37m-linux32.whl is not a supported wheel on this platform.
网上说改个文件名就可以,大家可以试试,我试过了也不行,然后看到文章说需要看看自己的pip支持的文件,然后就开始查看pip支持的whl文件,然后就报错标题了。
网上有很多方法,但都是两三年前的了,我用的pip是22.3.1版本,所以全都试了一遍还是错。给大家展示一下我的试错历程。
1、进入到Python中输入:
>>>import pip
>>> python -m pip debug --verbose
报错: File "<stdin>", line 1
python -m pip debug --verbose
^
SyntaxError: invalid syntax
2、>>> import pip._internal.pep425tags
报错:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pip._internal.pep425tags'
3、>>> import pip._internal; print(pip._internal.pep425tags.get_supported())
报错:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pip._internal' has no attribute 'pep425tags'
4、>>> import wheel.pep425tags as w
报错:Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'wheel.pep425tags'
5、>>> python -m pip debug --verbose
报错:File "<stdin>", line 1
python -m pip debug --verbose
^
SyntaxError: invalid syntax
这就是我试过的错了。突然想到这都是在Python中编辑,然后就退出了Python,进入虚拟环境中,直接输入pip install wheel;然后就成功了。,,,,我,,,,,,
成功显示就是这样的:
vendored library versions:
CacheControl==0.12.11
colorama==0.4.5
distlib==0.3.6
distro==1.7.0
msgpack==1.0.4
packaging==21.3
pep517==0.13.0
platformdirs==2.5.2
pyparsing==3.0.9
requests==2.28.1
certifi==2022.09.24
chardet==5.0.0
idna==3.4
urllib3==1.26.12
rich==12.5.1 (Unable to locate actual module version, using vendor.txt specified version)
pygments==2.13.0
typing_extensions==4.4.0 (Unable to locate actual module version, using vendor.txt specified version)
resolvelib==0.8.1
setuptools==44.0.0 (Unable to locate actual module version, using vendor.txt specified version)
six==1.16.0
tenacity==8.1.0 (Unable to locate actual module version, using vendor.txt specified version)
tomli==2.0.1
webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
Compatible tags: 537
cp37-cp37m-manylinux_2_31_x86_64
cp37-cp37m-manylinux_2_30_x86_64
cp37-cp37m-manylinux_2_29_x86_64
cp37-cp37m-manylinux_2_28_x86_64
cp37-cp37m-manylinux_2_27_x86_64
cp37-cp37m-manylinux_2_26_x86_64
cp37-cp37m-manylinux_2_25_x86_64
cp37-cp37m-manylinux_2_24_x86_64
cp37-cp37m-manylinux_2_23_x86_64
cp37-cp37m-manylinux_2_22_x86_64
cp37-cp37m-manylinux_2_21_x86_64
cp37-cp37m-manylinux_2_20_x86_64
然后就可以看到自己pip支持的文件类型了,然后就往后走吧。祝大家一路顺畅,别error!(来个绿色,一路绿灯)