pywin32

win10 64位 安装scrapy

妖精的绣舞 提交于 2020-04-24 18:43:25
在学习python时,不可避免下载了Anaconda,当我打算写爬虫时,urllib,requests,selenium,pyspider都已经安装好了,可以直接使用了,但是有一天我想要使用scrapy模块时,发现竟然没有安装,于是自己参照网上教程写下win64安装scrapy步骤: 1.升级pip python -m pip install --upgrade pip 2.安装wheel,有了wheel就可以离线安装各种模块了 pip install wheel 3.安装Twisted 从 https://www.lfd.uci.edu/~gohlke/pythonlibs/ 中找到Twisted进行下载。 像我这台机子又下python3.5又下了anaconda3,有时候会犯浑不知道自己要下载哪个版本的 参照如下命令可以查看pip支持的安装包名: >>> import pip._internal >>> print(pip._internal.pep425tags.get_supported()) [('cp36', 'cp36m', 'win_amd64'), ('cp36', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp36', 'none', 'any'), ('cp3', 'none', 'any'),

pyinstaller在64位系统下打包32位程序

别说谁变了你拦得住时间么 提交于 2020-04-24 08:35:09
使用环境说明:win10 64位,已安装python3.6-64位版本 遇到的问题:win10 64位打包成exe文件后,不能在32位系统运行 需求:使用python打包生成exe文件,win64位和32位exe均可运行 解决方法:不需要更换成32位的电脑,再进行封装,只需将python改为32位即可 1、下载安装32位python3.5(不限制版本号),下载地址 https://www.python.org/downloads/windows/ 2、下载安装32位pywin32,打包成exe需要pywin32这个包,下载地址 https://sourceforge.net/projects/pywin32/files/pywin32 下在pywin32后,点击安装,一直下一步即可,然后cmd进入python3.5目录 运行命令:./Scripts/pywin32_postinstall.py -install 3、下载安装pyinstaller3.4,下载地址 https://github.com/pyinstaller/pyinstaller 解压文件并将文件放入python3.5目录中,cmd进入pyinstaller目录 运行命令:python setup.py install 注:若电脑上已有64位python版本,建议将32位python.exe重新命名

Python

五迷三道 提交于 2020-04-23 14:57:33
一、概述 我一直使用pyinstaller将python代码封装好,给其它业务人员使用。这种办法的好处是业务人员不需要安装python程序了,直接双击我提交给他们的exe格式的文件即可。操作方便而且保护代码。但是现在又接到个需求,要通过python从oracle数据库中取数,可oracle的客户端是10g32位的,也就是说,我需要在64位系统下通过运行32位python,然后将python文件打包成32位的执行程序,这样做行不行?我的回答是行。 二、步骤 事先声明,请下载跟我一模一样的版本号,否则可能安装不成功 1. 下载32位python 3.5.4 由于oracle客户端是32位的,所以必须使用32位的python,幸好64位的操作系统是能够运行32位的python的。 下载地址, https://www.python.org/downloads/windows/ 2. 下载安装32位pywin32,打包成exe需要pywin32这个包。 下载地址: https://sourceforge.net/projects/pywin32/files/pywin32 3. 安装python 3.5.4 这一步没什么好说的,点击安装,一直下一步即可。唯一要注意的是将python的路径加到path里面即可 4. 安装pywin32 这一步也没什么好说的,点击安装,一直下一步即可。 5.

Pyinstaller (python打包为exe文件)

霸气de小男生 提交于 2020-04-23 10:54:33
需求分析: python脚本如果在没有安装python的机器上不能运行,所以将脚本打包成exe文件,降低脚本对环境的依赖性,同时运行更加迅速。 当然打包的脚本似乎不是在所有的win平台下都能使用,win7有一部分不能使用,我在win10能够很好的运行。 准备: pyinstaller ( http://www.pyinstaller.org ) 首先还是去官网看支持的python版本,不然会很尴尬的。 安装: 需要安装pyinstaller和pywin32 使用以下命令将会自动安装两个包,在cmd用pip命令 方法一: pip install -i https://pypi.douban.com/simple/pyinstaller(豆瓣源) 方法二: pip install pyinstaller(会自动下载future, pywin32, pyinstaller) 运行方式: 1、cmd进入到安装pyinstaller的python环境下的/python/scripts目录 找到pyinstaller.exe。 2、执行命令: pyinstaller.exe -F path:demo.py 案例: 将D:\pythonProject\python3.5\september19\calculator.py文件打为exe可执行文件 # 1

How is it possible to lock windows from a windows service?

最后都变了- 提交于 2020-04-18 05:43:55
问题 I'm writing a windows service in Python, which at some point needs to lock windows if a specific condition happens (for example the person leaves the pc un-attended for some time). The solution I found was to use user32.LockWorkStation() using the ctypes module. ctypes.windll.user32.LockWorkStation() However, after failing at locking the OS, I noticed the LockWorkstation specifically works in the interactive [desktop] mode which windows services do not support. it actually wasted quite a bit

Python实战:病毒困我于斗室,桌面带我去旅行

吃可爱长大的小学妹 提交于 2020-04-05 18:52:24
文章目录 1. 用Python设置Windows壁纸 2. 随机切换Windows壁纸 3. 定时切换Windows壁纸 近代史上,每一个庚子年都不寻常:1840年鸦片战争,1900年八国联军侵华,1960年大饥荒。2020年的这个春节,一场突如其来的新型冠状病毒疫情横扫东亚,大有席卷全球之势。这场无妄之灾,使得很多人放弃了聚会和旅行的计划,大家不得不蜗居于斗室。但是,病毒再猖狂,也无法阻止程序员对于美好的生活的向往。今天,我来教大家用Python做一个壁纸切换工具,展示以前旅行的照片,让桌面带我们去周游世界! 1. 用Python设置Windows壁纸 设置Windnows壁纸,需要修改Windows注册表,用Python操作Windows注册表,一般使用Pywin32模块。该模块包装了几乎所有的Windows API,可以方便地从Python直接调用。Pywin32允许你像VC一样的形式来使用Python开发win32应用,代码风格可以类似win32 sdk,也可以类似MFC,由你选择。安装Pywin32模块,可以使用如下命令直接安装,也可以从 Python模块仓库 下载whl文件在本地安装。 python -m pip install pywin32 用Python设置Windows壁纸,分为5步,核心代码只有5行: import win32api import

How to determine if win32api.ShellExecute was successful using hinstance?

守給你的承諾、 提交于 2020-03-18 06:40:14
问题 I've been looking around for an answer to my original issue.. how do i determine (programmatically) that my win32api.ShellExecute statement executed successfully, and if a successful execution occurs, execute an os.remove() statement. Researching I found out that the ShellExecute() call returns the HINSTANCE. Further digging I found that ShellExecute() will return an HINSTANCE > 32 if it was successful. My problem/question now is, how do i use it to control the rest of my program's flow? I

How to exit cleanly from flask and waitress running as a windows pywin32 service

前提是你 提交于 2020-02-10 20:03:19
问题 I have managed to cobble together a working demo of a pywin32 windows service running flask inside the pylons waitress wsgi server (below). A niece self contained solution is the idea.. I have spent hours reviewing and testing ways of making waitress exit cleanly (like this and this) but the best I can do so far is a kind of suicidal SIGINT which makes Windows complain "the pipe has been ended" when stopping through the Services control panel, but at least it stops :-/ I guess the

How to exit cleanly from flask and waitress running as a windows pywin32 service

无人久伴 提交于 2020-02-10 20:02:51
问题 I have managed to cobble together a working demo of a pywin32 windows service running flask inside the pylons waitress wsgi server (below). A niece self contained solution is the idea.. I have spent hours reviewing and testing ways of making waitress exit cleanly (like this and this) but the best I can do so far is a kind of suicidal SIGINT which makes Windows complain "the pipe has been ended" when stopping through the Services control panel, but at least it stops :-/ I guess the

How to exit cleanly from flask and waitress running as a windows pywin32 service

久未见 提交于 2020-02-10 20:01:32
问题 I have managed to cobble together a working demo of a pywin32 windows service running flask inside the pylons waitress wsgi server (below). A niece self contained solution is the idea.. I have spent hours reviewing and testing ways of making waitress exit cleanly (like this and this) but the best I can do so far is a kind of suicidal SIGINT which makes Windows complain "the pipe has been ended" when stopping through the Services control panel, but at least it stops :-/ I guess the