pycharm + venv 虚拟环境安装pywin32

本文详细介绍如何通过pip安装wheel并下载与安装pywin32模块,包括选择正确的版本、放置whl包到venv目录、使用pip进行安装,以及在PyCharm中配置和验证安装过程。

1.下载wheel

pip install wheel -i https://pypi.tuna.tsinghua.edu.cn/simple

2.下载pywin32安装包

选择对应的版本:
cp27/cp37 指python27或者37
win32/amd64 指32位或者64位操作系统

我下载的是:
pywin32-228-cp37-cp37m-win_amd64.whl
已上传csdn供大家下载
csdn下载链接

pywin32官网网址

3.安装pywin32

win32的whl包放到项目的venv/下面方便使用
terminal进入venv/下
pip 安装

pip install pywin32-228-cp37-cp37m-win_amd64.whl

4.关键最后一步

1.pycharm–setting–project interpreter看到pywin32已经在列表中
2.点右边+号,对话框搜索pywin32,看到绿色的pywin32显示版本为下载的whl包版本
3.点击左下角install package,显示安装成功
4.验证 脚本中import win32con 不报错,ctrl +鼠标左键可以进入win32con.py

大功告成,开始与windows交互吧
(venv) PS D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client> python D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client\venv\Scripts\pywin32_postinstall.py -install Parsed arguments are: Namespace(install=True, remove=False, wait=None, silent=False, quiet=False, destination='D:\\GaPinyc\\SQLite_sync_Mysql\\DB_Sync_Client\\venv\\Lib\\site-packages') The file 'C:\WINDOWS\system32\pythoncom310.dll' exists, but can not be replaced due to insufficient permissions. You must reinstall this software as an Administrator Traceback (most recent call last): File "D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client\venv\Scripts\pywin32_postinstall.py", line 424, in install CopyTo("installing %s" % base, fname, dst) File "D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client\venv\Scripts\pywin32_postinstall.py", line 125, in CopyTo win32api.CopyFile(src, dest, 0) pywintypes.error: (5, 'CopyFile', '拒绝访问。') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client\venv\Scripts\pywin32_postinstall.py", line 733, in <module> main() File "D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client\venv\Scripts\pywin32_postinstall.py", line 726, in main install(args.destination) File "D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client\venv\Scripts\pywin32_postinstall.py", line 455, in install raise RuntimeError(msg) RuntimeError: The file 'C:\WINDOWS\system32\pythoncom310.dll' exists, but can not be replaced due to insufficient permissions. You must reinstall this software as an Administrator (venv) PS D:\GaPinyc\SQLite_sync_Mysql\DB_Sync_Client>
最新发布
09-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值