python开发windows桌面应用,python桌面应用开发框架

大家好,小编来为大家解答以下问题,python开发windows桌面应用,python桌面应用开发框架,现在让我们一起来看看吧!

image.png

image.png

这两天终于要开始做产品客户端,这个早就定下来用electron做了。原因很简单,以前用winform开发已经一万点伤害...用python画满天星的代码。简直就是反人类,现在想起来都想吐。这年头也没几个人再写winform了吧?

vue+electron再加上一款称心如意的UI库(打算选Bulma),不能再顺手,想想都激动。

本来觉得挺简单,vue开发,差不多了打包到dist,再丢到electron里去打包,运行。甚至自己还建了一个vue+electron工程,思路就是electron里包含vue...有点狠。但是一开始就发现问题了。工程中要用到electron node得时候,必须要打包才可以,而且这样切换,实在是很麻烦有木有?

于是在程序员hub上找到了一个2.2k星星的项目electron-vue,很顺手。记录如下:

npm install -g vue-cli

vue init simulatedgreg/electron-vue my-project

cd my-project

yarn # or npm install

yarn run dev # or npm run dev

...and boom! You now have a running electron-vue app.

直接就可以得到如下界面:

image.png

vue全家桶自带

带调试工具

页面不刷新加载

直接带各种打包测试工具

是不是有点小激动?

但这个世界总是对windows用户充满深深的敌意...

A note for Windows Users

If you run into errors during npm install

about node-gyp

, then you most likely do not have the proper build tools installed on your system. Build tools include items like Python and Visual Studio. Thanks to @felixrieseberg, there are a few packages to help simplify this process.

The first item we need to check is our npm version and ensure that it is not outdated. This can is accomplished using npm-windows-upgrade. If you are using yarn

, then you can skip this check.

Once that is complete, we can then continue to setup the needed build tools. Using windows-build-tools, most of the dirty work is done for us. Installing this globally will in turn setup Visual C++ packages, Python, and more.

At this point things should successfully install, but if not then you will need a clean installation of Visual Studio. Please note that these are not direct problems with electron-vue itself (Windows can be difficult sometimes ¯_(ツ)_/¯).

大致就是说,windows下npm i时会在node安装时卡住(真的会卡住),这是由于win下缺乏正确的构建工具,那么只要这样做就可以解决:

1. 以管理员身份打开power shell//cmd应该也可以,我没试

2. 输入 Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

3. npm install --global --production npm-windows-upgrade

4. npm-windows-upgrade

5. 然后还要安装Windows-Build-Tools:

npm install --global --production windows-build-tools

等上面做完了就可以了,这时npm i一路绿灯通过。愉快的输入npm run dev开始玩耍吧!

  • 20
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值