您当前的位置:首页 > 学海无涯 > 心得笔记网站首页心得笔记
Python制作WHL文件
发布时间:2021-05-13作者:♂逸風★淩軒
一、制作WHL文件,可以跨机器windows安装Python包而无需担心Microsoft Visual C++ 14.0 is required错误,注意制作机仍需要方案二安装vs
1、安装whl组件
pip3 install wheel
2、下载组件源码包
wget https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
3、制作whl包
tar -zxvf pycrypto-2.6.1.tar.gz cd pycrypto-2.6.1 pip wheel -w, -wheel-dir ./
回显
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Processing d:\code\python\apicenter\pycrypto-2.6.1\pycrypto-2.6.1 DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default. pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555. Building wheels for collected packages: pycrypto Building wheel for pycrypto (setup.py) ... done Created wheel for pycrypto: filename=pycrypto-2.6.1-cp36-cp36m-win_amd64.whl size=522144 sha256=042a1f6124620c4f7b90fadc59255b71e9a4152f18a0780d2bf4beacfb3f7277 Stored in directory: c:\users\zhouqy\appdata\local\pip\cache\wheels\f9\fc\32\4d7d02b34a1315297a45ad59eb93c709cec09df0e64652cfd1 Successfully built pycrypto
4、拷贝对应的whl文件到其他出安装
pip install pycrypto-2.6.1-cp36-cp36m-win_amd64.whl
提供一个pycrypto的基于Python3.6的windows 64位whl文件
pycrypto-2.6.1-cp36-cp36m-win_amd64.zip
二、如果不考虑whl安装方式,则需要部署安装Visual Studio 2015
1、解决下属问题:
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools"
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
下载链接:
http://download.microsoft.com/download/0/B/C/0BC321A4-013F-479C-84E6-4A2F90B11269/vs2015.com_enu.iso
安装界面,只选择”Common Tools for VisualC++2015“。
2、配置变量解决以下问题:
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
方案:
set CL=/FI"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\stdint.h"
注意实际的部署vs路径
3、问题:
File "D:\code\python\venv\lib\site-packages\Crypto\Random\OSRNG\nt.py", line 28, in <module> import winrandom ModuleNotFoundError: No module named 'winrandom'
处理:
修改python3安装目录下的 lib/Crypto/Random/OSRNG/nt.py 文件中找到
import winrandom
修改为
from Crypto.Random.OSRNG import winrandom
三、直接下载编译好的whl文件
关键字词:Microsoft Visual C++ 14.0 is required,whl,pycrypto

下一篇:Docker 常用命令
相关文章
-
无相关信息