python安装插件包注意事项

时间:2023-03-08 20:32:27
python安装插件包注意事项

注意!注意!注意!
安装以来lib库时强烈建议使用pip安装:
原因:
nu1:用exe安装会出现各种意想不到让您惊讶的错误!!!
nu2:这种错误很难解决且花费无用功!!!

使用pip安装:

nu1:使用.whl文件(Python库路径 http://www.lfd.uci.edu/~gohlke/pythonlibs/),如pip install xxx.whl

nu2:直接装 pip install xxx,如pip install xlwt(安装xlwt插件库)

安装过程中遇到的问题:

nu1:XXX is not a supported wheel on this platform,解决办法:进入python命令行界面输入import pip; print(pip.pep425tags.get_supported())可以获取到pip支持的文件名还有版本
如:安装 pip install numpy-1.10.4+mkl-cp27-cp27m-win32.whl 报错
>>import pip; print(pip.pep425tags.get_supported())
[('cp27', 'none', 'win32'), ('py2', 'none', 'win32'), ('cp27', 'none', 'any'), ('cp2', 'none', 'any'), ('cp26', 'none', 'any'), ('cp25', 'none', 'any'), ('cp24', 'none', 'any'), ('cp23', 'none', 'any'), ('cp22', 'none', 'any'), ('cp21', 'none', 'any'), ('cp20', 'none', 'any'), ('py27', 'none', 'any'), ('py2', 'none', 'any'), ('py26', 'none', 'any'), ('py25', 'none', 'any'), ('py24', 'none', 'any'), ('py23', 'none', 'any'), ('py22', 'none', 'any'), ('py21', 'none', 'any'), ('py20', 'none', 'any')]
通过这里可以发现上面下载的文件名格式是不支持的,修改为:numpy-1.10.4+mkl-cp27-none-win32.whl即可成功安装。

nu2:注意库之间的依赖安装循序
如numpy 和 matplotlib ,装matplotlib需要依赖numpy,因此要先装numpy再装matplotlib

nu3:注意库版的py版本号要与python好保持一致
如umpy-1.10.4+mkl-cp27-none-win32.whl ,cp27代表python2.7版本

检查插件库是否正确安装:

nu1:进入python命令行 直接执行 improt XXX(插件名)如import numpy 没有报错或者任何提示说明安装成功