Python 官方文档:入门教程 => 点击学习
报错详情: 原因是因为np.int在numpy1.20已经被废弃掉了,可以通过 pip show numpy 在命令行里查看。 现在使用的是np.int_ 或者 np.int32 或者 np.in
原因是因为np.int在numpy1.20已经被废弃掉了,可以通过
pip show numpy
在命令行里查看。
现在使用的是np.int_
或者 np.int32
或者 np.int64
但这个报错是在我自己的site-packages里的numpy的报错,我怀疑可能是numpy本身的问题,所以通过命令
pip uninstall numpy
把这个numpy给uninstall了
pip install numpy-xxxx.whl
安装numpy使用命令:
pip debug --verbose
查看当前python支持的版本
D:\app\Scripts>D:\app\Python.exe -m pip debug --verboseWARNING: 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.exesys.getdefaultencoding: utf-8sys.getfilesystemencoding: utf-8locale.getpreferredencoding: cp936sys.platfORM: win32sys.implementation: name: cpython'cert' config value: Not specifiedREQUESTS_CA_BUNDLE: NoneCURL_CA_BUNDLE: Nonepip._vendor.certifi.where(): D:\app\lib\site-packages\pip\_vendor\certifi\cacert.pempip._vendor.DEBUNDLED: Falsevendored 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位
如果文件名不规范,不符合上面支持的格式,在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在上面支持的格式中出现
出现Successfull installed就安装好啦!
用python验证一下:或者直接输入python,我这里是指定了python。
然后就没有那个错误啦!
来源地址:https://blog.csdn.net/weixin_45454859/article/details/128546147
--结束END--
本文标题: 报错 cannot import name ‘int‘ from ‘numpy‘
本文链接: https://lsjlt.com/news/414046.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0