简体   繁体   English

如何为要在 windows10 上的 python3.8 32bits 上运行的库打包一个轮子?

[英]How to package a wheel for a library meant to run on python3.8 32bits on windows10?

Initial question (2020-02-15)初始问题 (2020-02-15)

I'm building a python library: my_custom_library , with standard requirements (NumPy, pandas, librosa ...) and custom functions.我正在构建一个 python 库: my_custom_library ,具有标准要求(NumPy、pandas、librosa ...)和自定义函数。

I would like to build a wheel of my_custom_library to then pip install this library on python3.8 32bits on windows10 on a machine with no access to internet (flash drive transfert).我想构建一个my_custom_library的轮子,然后在无法访问互联网(闪存驱动器传输)的机器上的 windows10 上的 python3.8 32bits 上pip install此库。 This install should be a "true" windows10 install and should not require WSL.这个安装应该是一个“真正的” windows10安装,应该不需要WSL。

I would consider the packaging a success if I could produce one file my_custom_library-0.0.0-win32.whl similar to numpy-1.18.1-cp38-cp38-win32.whl on https://pypi.org/project/numpy/#files .如果我可以在https://pypi.org/project/numpy/上生成一个类似于numpy-1.18.1-cp38-cp38-win32.whl文件my_custom_library-0.0.0-win32.whl我会认为打包是成功的#文件 This package is meant to stay private, I don't want to publish anything on pypi.这个包是为了保密,我不想在 pypi 上发布任何东西。

What is the best practice to build the wheel of my_custom_library for windows10 ?windows10构建my_custom_library的轮子的最佳实践是什么?

What is the shortest list of commands to do that ?执行此操作的最短命令列表是什么?

From what I saw, it seems I need to build the wheel on the same OS as the OS where the wheel will be installed.从我所看到的,似乎我需要在与安装轮子的操作系统相同的操作系统上构建轮子。

Can I build the wheel on a linux machine (ubuntu 18.04LTS) and install it on windows10 ?我可以在 linux 机器(ubuntu 18.04LTS)上构建轮子并将其安装在 windows10 上吗?

If it's possible, what is the shortest list of commands to do that ?如果可能,那么最短的命令列表是什么?


Requirements (2020-02-17)要求 (2020-02-17)

my_custom_library will import many well-known libraries including: my_custom_library将导入许多著名的库,包括:

librosa==0.7.1 
matplotlib==3.1.1
numpy==1.16.4
opencv-python==4.1.2.30
pandas==0.24.2
scikit-learn==0.21.3
scipy==1.3.2

Can I build the wheel on a linux machine (ubuntu 18.04LTS) and install it on windows10 ?我可以在 linux 机器(ubuntu 18.04LTS)上构建轮子并将其安装在 windows10 上吗?

Pure Python library — yes.纯 Python 库——是的。 Actually a pure Python library doesn't need to be platform-specific at all, you can build a universal wheel or use sdist (source distribution).实际上,纯 Python 库根本不需要特定于平台,您可以构建一个万能轮或使用 sdist(源代码分发)。

But if the library has code written in C/C++ then no, you have to build it on an exact platform (processor architecture, minimal OS version, exact Python version).但是,如果库中有用 C/C++ 编写的代码,那么就不能,您必须在精确的平台(处理器架构、最小操作系统版本、精确的 Python 版本)上构建它。 You can build 32-bit library on a 64-bit Windows using 32-bit Python.您可以使用 32 位 Python 在 64 位 Windows 上构建 32 位库。 But not the other way around — you cannot build 64-bit library on a 32-bit Windows.但反之亦然——您不能在 32 位 Windows 上构建 64 位库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 debian 10 上安装 python3.8? - How to Install python3.8 on debian 10? 如何在 debian 10 上使用 checkinstall 安装 python3.8? - How to Install python3.8 using checkinstall on debian 10? Windows 中没有名为“tkinter”(Python3.8)的模块 - No module named 'tkinter' (Python3.8) in Windows 即使使用 dll 也无法识别 Glut 方法(Pyopengl3/Python3.8/Windows10-64) - Glut methods not recognised even with dll's(Pyopengl3/Python3.8/Windows10-64) 无法使用 python 3.8 安装 ssh2-python wheel 文件,尽管它适用于 python3.8 - Can't install ssh2-python wheel file with python 3.8 although it's for python3.8 使用windows10任务调度程序运行python脚本,使用win32运行excel文件。 每当用户登录或未登录时 - Using windows10 task scheduler to run python script that uses win32 to run excel file. Whenever user is logged in or not 如何在 Ubuntu 上为 python3.8 安装 tkinter? - How to install tkinter for python3.8 on Ubuntu? 如何在win10的anaconda(python3.8)中安装infomap模块? - How to install infomap module in anaconda(python3.8) on win10? windows10 用户无法运行 python,只有管理员 - windows10 user cannot run python, only admin 如何在Windows10中从bash提示符运行python'__main__'程序文件? - How do I run python '__main__' program file from bash prompt in Windows10?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM