报错详情:
原因是因为np.int在numpy1.20已经被废弃掉了,可以通过
pip show numpy
在命令行里查看。
现在使用的是np.int_
或者 np.int32
或者 np.int64
猜测原因
但这个报错是在我自己的site-packages里的numpy的报错,我怀疑可能是numpy本身的问题,所以通过命令
pip uninstall numpy
把这个numpy给uninstall了
大致方法流程:
- uninstall numpy
- 然后删掉numpy的whl文件,再去python扩展包网页下载一个版本匹配的whl文件
- 把whl文件放在script文件夹里面,然后通过
pip install numpy-xxxx.whl
安装numpy
具体:
1.如何选择下载哪一个呢?
使用命令:
pip debug --verbose
查看当前python支持的版本
D:\app\Scripts>D:\app\python.exe -m pip debug --verbose
WARNING: This command is only meant for debugging. Do not use this with automation for parsing and getting these details, since the output and options of this command may change without notice.
pip version: pip 22.3.1 from D:\app\lib\site-packages\pip (python 3.8)
sys.version: 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
sys.executable: D:\app\python.exe
sys.getdefaultencoding: utf-8
sys.getfilesystemencoding: utf-8
locale.getpreferredencoding: cp936
sys.platform: win32
sys.implementation:
name: cpython
'cert' config value: Not specified
REQUESTS_CA_BUNDLE: None
CURL_CA_BUNDLE: None
pip._vendor.certifi.where(): D:\app\lib\site-packages\pip\_vendor\certifi\cacert.pem
pip._vendor.DEBUNDLED: False
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: 30
cp38-cp38-win_amd64
cp38-abi3-win_amd64
cp38-none-win_amd64
cp37-abi3-win_amd64
cp36-abi3-win_amd64
cp35-abi3-win_amd64
cp34-abi3-win_amd64
cp33-abi3-win_amd64
cp32-abi3-win_amd64
py38-none-win_amd64
py3-none-win_amd64
py37-none-win_amd64
py36-none-win_amd64
py35-none-win_amd64
py34-none-win_amd64
py33-none-win_amd64
py32-none-win_amd64
py31-none-win_amd64
py30-none-win_amd64
cp38-none-any
py38-none-any
py3-none-any
py37-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any
重点关注后面的,就是支持的版本的名称,也就是后面whl文件你要修改的名字
cp38-cp38-win_amd64
cp38-abi3-win_amd64
cp38-none-win_amd64
cp37-abi3-win_amd64
cp36-abi3-win_amd64
cp35-abi3-win_amd64
cp34-abi3-win_amd64
cp33-abi3-win_amd64
cp32-abi3-win_amd64
py38-none-win_amd64
py3-none-win_amd64
py37-none-win_amd64
py36-none-win_amd64
py35-none-win_amd64
py34-none-win_amd64
py33-none-win_amd64
py32-none-win_amd64
py31-none-win_amd64
py30-none-win_amd64
cp38-none-any
py38-none-any
py3-none-any
py37-none-any
py36-none-any
py35-none-any
py34-none-any
py33-none-any
py32-none-any
py31-none-any
py30-none-any
这些都是可以下载的版本
因为我python版本是3.8.3,所以我选择的是
38代表python版本,64代表64位
2.修改文件名:
如果文件名不规范,不符合上面支持的格式,在pip install numpy-xxx.whl时就会出现
numpy-1.19.5+mkl-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
这样的的报错
改成这样就好啦:保证最后的cp38-cp38-win_amd64在上面支持的格式中出现
3.安装whl文件:
出现Successfull installed就安装好啦!
用python验证一下:或者直接输入python,我这里是指定了python。
然后就没有那个错误啦!
文章出处登录后可见!
已经登录?立即刷新