[Python]Numpy安装及一些玄学问题(is not a supported wheel on this platform、Undefined variable from import)
来源:互联网 发布:石岐unity3d招聘 编辑:程序博客网 时间:2024/05/21 09:37
numpy是python的一个科学计算库,可以实现matlab里的数学运算,基本是用python做数值运算的人必装的一个的库了。
然而今天我安装这个库遇到了一些以前一直没遇到的问题,挺迷的,我之前安装从来没遇到过,只在这台神船上遇到,记录一下吧,或许别人也遇到了同样的问题。
>Numpy的安装
安装地址见:https://pypi.python.org/pypi/numpy/
选择适合自己的版本下载。(cpxx是python的版本)
然后把下载到的文件,拖动到python文件夹下的Scripts文件夹里,例如我的是:D:\Python2.7.13\Scripts
>配置环境变量
右键我的电脑-属性-高级-环境设置-path-编辑
添加一行:
D:\Python2.7.13\Scripts;(注意分号)
>从dos安装
打开cmd,输入以下指令:
pip2.7 install D:\Python2.7.13\Scripts\numpy-1.13.0rc2-cp27-none-win_amd64.whl // 也就是pip2.7 install 安装地址+文件名
安装成功会提示install success啥的。
------------------------------------
>玄学问题
重点来了,今天我一共遇到了两个玄学问题:
>1.Dos安装时,提示is not a supported wheel on this platform
64位的朋友,如果你们下载的是对应正确的python版本和正确位数的whl文件(例如我是python2.7和win64),仍然提示这个错误,有可能是因为控制台cmd32的原因。
不要从Win+R启动cmd,进入系统盘./Windows/SysWow64,在这个文件夹中打开cmd.exe,然后输入指令进行安装;
如果仍然不行,试试32位的whl,一般都能安装上。
这点有点玄学,具体我也说不上是个为啥,用了这么久也是第一次遇上。我猜可能是因为我自己做过这个window系统,我可能魔改了什么设置导致了这个问题的发生。
>2.Undefined variable from import xxx
严格来说,这是个老问题了。导入第三方库的时候,很大几率会导致IDE报错这个问题,但是实际上程序运行又毫无问题,就是红红的报警看着神烦。
网上有大量类似的咨询帖。这里我稍微整理了一下:
①.鸵鸟政策:
如果你用的是eclipse,window -- preferences -- pydev -- editor -- code analysis -- Undefined -- undefined variable from import,改成warning。
这个方法最简单,但是总觉得不那么畅快。
②.导入路径:
其一:
https://stackoverflow.com/questions/13842194/undefined-variable-from-import-when-importing-numpy-in-eclipse-pydev
其二:
进入Window ->perferences ->pydev ->Interpreter – Python ->libraries,添加库的路径.
③.玄学解法
我也不知道为什么,以上两个方法,第一个方法我觉得不能治本,就没那么做。
第二个失败...
于是我冷静了一下,想起来网吧老板的一句名言:
没有什么是重启解决不了的,如果有,那就再重启一次。
Er....重启之后:
迷之玄学....总之是解决了这个问题。
>顺便测试了一下Numpy的矩阵:
最后我还有一句话:魔改系统有风险!!!
- [Python]Numpy安装及一些玄学问题(is not a supported wheel on this platform、Undefined variable from import)
- python中的lxml的安装+*.whl is not a supported wheel on this platform.
- 安装python出现is not a supported wheel on this platform解决办法
- Python——pip安装报错:is not a supported wheel on this platform
- 成功解决安装scikit image出现‘is not a supported wheel on this platform’问题
- whl is not a supported wheel on this platform.
- pip安装python库报错:Pillow-4.2.1-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.
- pip安装报错:is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- pip 安装错误 : is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- 使用pip安装tensorflow报错:tensorflow---- is not a supported wheel on this platform.
- pip安装报错:is not a supported wheel on this platform
- pip安装报错:is not a supported wheel on this platform
- 数据结构---先序遍历
- chisel入门踩坑
- SQLite加密
- 超级淘背后的秘密,发家致富不是梦
- 【Linux】 JDK安装及配置 (tar.gz版)
- [Python]Numpy安装及一些玄学问题(is not a supported wheel on this platform、Undefined variable from import)
- Android DataBinding使用总结(二)
- python3爬虫无法显示中文问题解决
- 求两字符串最长公共连续子串---C++编程
- 【贪心算法】贪心算法与活动安排问题
- Win10修复Linux引导
- Spring MVC 之 处理Date类型
- 一个安卓锁机病毒的分析报告
- Apache和Tomcat有什么不同,为什么要整合Apache和Tomcat