博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
离线安装wxpython
阅读量:2495 次
发布时间:2019-05-11

本文共 7765 字,大约阅读时间需要 25 分钟。

前言

由于工作环境,我的工作机是在离线环境下的,没法连接外网。但是自己又想学习一下wxpython,只好自己手动离线安装,本来以为很简单的,但是实际上。。。一言难尽。

基本环境:python pip easy_install

安装python2.7

直接下载msi数据包安装,如果无法识别安装,那么:

  • 1、确定msi数据包的完整性,包括大小、格式;

  • 2、确定开启开启windows installer:win + R –> 输入Services.msc –> 找到windows installer –> 左侧手动启用

python3.X 安装更为简单,直接双击.exe文件安装即可,且都需要选定添加环境变量。

安装wxpython

1、下载

下载地址:

选择对应的文件进行安装,我的选择是: wxPython-4.0.1-cp27-cp27m-win_amd64.whl

其中:

cp27 表示 python2.7

win_amd64 表示 windows 64位

在这之外:win32 表示 32位

2、安装

将下载好的wxpython**.whl文件转移到python安装路径下的Scripts目录下,我的是:C:\Python27\Scripts

然后打开cmd或者powershell,切换到该目录下:

PS C:\User\Yanta> cd C:\Python27\Scripts

执行命令 pip install wxPython-4.0.1-cp27-cp27m-win_amd64.whl ,此时会报错:wxPython-4.0.1-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.

PS C:\Python27\Scripts> pip install .\wxPython-4.0.1-cp27-cp27m-win_amd64.whlwxPython-4.0.1-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.

此时可以尝试使用easy_install安装,结果提示缺少 six 包。

PS C:\Python27\Scripts> .\easy_install-2.7.exe .\wxPython-4.0.1-cp27-cp27m-win_amd64.whlProcessing wxPython-4.0.1-cp27-cp27m-win_amd64.whlc:\python27\lib\site-packages\setuptools\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect  warn=(impl == 'cp')):c:\python27\lib\site-packages\setuptools\pep425tags.py:93: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect  warn=(impl == 'cp')):c:\python27\lib\site-packages\setuptools\pep425tags.py:99: RuntimeWarning: Config variable 'Py_UNICODE_SIZE' is unset, Python ABI tag may be incorrect  sys.version_info < (3, 3))) \Installing wxPython-4.0.1-cp27-cp27m-win_amd64.whl to c:\python27\lib\site-packageswriting requirements to c:\python27\lib\site-packages\wxPython-4.0.1-py2.7-win-amd64.egg\EGG-INFO\requires.txtAdding wxPython 4.0.1 to easy-install.pth fileInstalling wxdemo-script.py script to c:\python27\ScriptsInstalling wxdemo.exe script to c:\python27\ScriptsInstalling img2png-script.py script to c:\python27\ScriptsInstalling img2png.exe script to c:\python27\ScriptsInstalling pyslices-script.py script to c:\python27\ScriptsInstalling pyslices.exe script to c:\python27\ScriptsInstalling img2py-script.py script to c:\python27\ScriptsInstalling img2py.exe script to c:\python27\ScriptsInstalling pyslicesshell-script.py script to c:\python27\ScriptsInstalling pyslicesshell.exe script to c:\python27\ScriptsInstalling wxget-script.py script to c:\python27\ScriptsInstalling wxget.exe script to c:\python27\ScriptsInstalling helpviewer-script.py script to c:\python27\ScriptsInstalling helpviewer.exe script to c:\python27\ScriptsInstalling pyshell-script.py script to c:\python27\ScriptsInstalling pyshell.exe script to c:\python27\ScriptsInstalling pycrust-script.py script to c:\python27\ScriptsInstalling pycrust.exe script to c:\python27\ScriptsInstalling wxdocs-script.py script to c:\python27\ScriptsInstalling wxdocs.exe script to c:\python27\ScriptsInstalling pywxrc-script.py script to c:\python27\ScriptsInstalling pywxrc.exe script to c:\python27\ScriptsInstalling img2xpm-script.py script to c:\python27\ScriptsInstalling img2xpm.exe script to c:\python27\ScriptsInstalled c:\python27\lib\site-packages\wxpython-4.0.1-py2.7-win-amd64.eggProcessing dependencies for wxPython==4.0.1Searching for sixReading https://pypi.python.org/simple/six/Download error on https://pypi.python.org/simple/six/: [Errno 11004] getaddrinfo failed -- Some packages may not be found!Couldn't find index page for 'six' (maybe misspelled?)Scanning index of all packages (this may take a while)Reading https://pypi.python.org/simple/Download error on https://pypi.python.org/simple/: [Errno 11004] getaddrinfo failed -- Some packages may not be found!No local packages or working download links found for sixerror: Could not find suitable distribution for Requirement.parse('six')

然后安装 six ,下载地址:

选择 six-1.11.0-py2.py3-none-any.whl ,一样拷贝到C:\Python27\Scripts下,使用pip安装:

PS C:\Python27\Scripts> .\easy_install-2.7.exe .\six-1.11.0-py2.py3-none-any.whlProcessing six-1.11.0-py2.py3-none-any.whlc:\python27\lib\site-packages\setuptools\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect  warn=(impl == 'cp')):c:\python27\lib\site-packages\setuptools\pep425tags.py:93: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect  warn=(impl == 'cp')):c:\python27\lib\site-packages\setuptools\pep425tags.py:99: RuntimeWarning: Config variable 'Py_UNICODE_SIZE' is unset, Python ABI tag may be incorrect  sys.version_info < (3, 3))) \Installing six-1.11.0-py2.py3-none-any.whl to c:\python27\lib\site-packagesAdding six 1.11.0 to easy-install.pth fileInstalled c:\python27\lib\site-packages\six-1.11.0-py2.7.eggProcessing dependencies for six==1.11.0Finished processing dependencies for six==1.11.0

此时再次使用easy_install安装wxpython即可:

PS C:\Python27\Scripts> .\easy_install-2.7.exe .\wxPython-4.0.1-cp27-cp27m-win_amd64.whlProcessing wxPython-4.0.1-cp27-cp27m-win_amd64.whlc:\python27\lib\site-packages\setuptools\pep425tags.py:89: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect  warn=(impl == 'cp')):c:\python27\lib\site-packages\setuptools\pep425tags.py:93: RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect  warn=(impl == 'cp')):c:\python27\lib\site-packages\setuptools\pep425tags.py:99: RuntimeWarning: Config variable 'Py_UNICODE_SIZE' is unset, Python ABI tag may be incorrect  sys.version_info < (3, 3))) \removing 'c:\python27\lib\site-packages\wxPython-4.0.1-py2.7-win-amd64.egg' (and everything under it)Installing wxPython-4.0.1-cp27-cp27m-win_amd64.whl to c:\python27\lib\site-packageswriting requirements to c:\python27\lib\site-packages\wxPython-4.0.1-py2.7-win-amd64.egg\EGG-INFO\requires.txtwxPython 4.0.1 is already the active version in easy-install.pthInstalling wxdemo-script.py script to c:\python27\ScriptsInstalling wxdemo.exe script to c:\python27\ScriptsInstalling img2png-script.py script to c:\python27\ScriptsInstalling img2png.exe script to c:\python27\ScriptsInstalling pyslices-script.py script to c:\python27\ScriptsInstalling pyslices.exe script to c:\python27\ScriptsInstalling img2py-script.py script to c:\python27\ScriptsInstalling img2py.exe script to c:\python27\ScriptsInstalling pyslicesshell-script.py script to c:\python27\ScriptsInstalling pyslicesshell.exe script to c:\python27\ScriptsInstalling wxget-script.py script to c:\python27\ScriptsInstalling wxget.exe script to c:\python27\ScriptsInstalling helpviewer-script.py script to c:\python27\ScriptsInstalling helpviewer.exe script to c:\python27\ScriptsInstalling pyshell-script.py script to c:\python27\ScriptsInstalling pyshell.exe script to c:\python27\ScriptsInstalling pycrust-script.py script to c:\python27\ScriptsInstalling pycrust.exe script to c:\python27\ScriptsInstalling wxdocs-script.py script to c:\python27\ScriptsInstalling wxdocs.exe script to c:\python27\ScriptsInstalling pywxrc-script.py script to c:\python27\ScriptsInstalling pywxrc.exe script to c:\python27\ScriptsInstalling img2xpm-script.py script to c:\python27\ScriptsInstalling img2xpm.exe script to c:\python27\ScriptsInstalled c:\python27\lib\site-packages\wxpython-4.0.1-py2.7-win-amd64.eggProcessing dependencies for wxPython==4.0.1Finished processing dependencies for wxPython==4.0.1

3、测试

安装过后测试一下,是否可以导入wx包:

PS C:\Python27\Scripts> py -2          Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>> import wx

4、NOTE

本机安装有python2.7和3.6两个版本,使用py -2 和py -3分别指向2.7和3.6,在python脚本中使用:

#!/user/bin/env python2#!/user/bin/env python3

分别指定即可。

转载地址:http://oworb.baihongyu.com/

你可能感兴趣的文章
JPA自定义sql
查看>>
BigDecimal正确使用了吗?
查看>>
joplin笔记
查看>>
JNDI+springmvc使用
查看>>
vue+springboot分页交互
查看>>
vue+springboot打包发布
查看>>
XSL 开发总结
查看>>
beta阶段第六次scrum meeting
查看>>
SpringBoot+MybatisPlus实现批量添加的两种方式
查看>>
vue 设计结构
查看>>
Sqlerver2005+按照ID分组取前几条
查看>>
Python的编码和解码
查看>>
docker
查看>>
停车场系统安全岛设计施工要求
查看>>
Docker实战
查看>>
asp.net core结合Gitlab-CI实现自动化部署
查看>>
RDIFramework.NET ━ .NET快速信息化系统开发框架 V2.7 版本发布
查看>>
EasyNVR H5无插件摄像机直播解决方案前端解析之:关于直播页面和视频列表页面切换的问题...
查看>>
django搭建一个小型的服务器运维网站-拿来即用的bootstrap模板
查看>>
redis事务
查看>>