I want to download some python package from Win to Linux.
I run pip download -r requirements.txt -d wheelhouse
on Win10,
but it will download the win version package numpy-1.19.1-cp37-cp37m-win_amd64.whl
Can i download with linux verson of package on win.
Asked
Active
Viewed 296 times
-3

roamer
- 143
- 1
- 9
-
1What do you expect the difference to be? – kaya3 Mar 24 '21 at 13:31
-
What is the point of doing this? – CATboardBETA Mar 24 '21 at 13:31
-
I suppose one reason may be that you want to build a Linux Docker container on a Windows machine and test such software. Though I would try to use the `any` distribution. In any case, the `--platform` option should do the trick. See answer below. – astrochun Mar 24 '21 at 13:41
-
https://stackoverflow.com/search?q=%5Bpip%5D+download+Linux+windows – phd Mar 24 '21 at 14:28
-
@kaya3 Binary wheels contain compiled extensions, different for every platform (processor architecture, OS, Python version, 32/64-bits). – phd Mar 24 '21 at 14:30
-
@CATboardBETA To copy the downloaded wheels to an offline host with a different architecture. – phd Mar 24 '21 at 14:30
1 Answers
3
I'm not entirely sure why you would want to do this. By default, pip
uses your local architecture so it downloads the windows files. The pip download
options has a --platform
option.
You can try: pip download -r requirements.txt -d wheelhouse_linux --platform manylinux1_x86_64 [--only-binary=:all: or --no-deps]
The documentation for pip download
is available here with examples.

astrochun
- 1,642
- 2
- 7
- 18
-
"*I'm not entirely sure why you would want to do this…*" To copy the downloaded wheels to an offline host with a different architecture. – phd Mar 24 '21 at 14:25
-
-
I think you're right. I guess those examples are outdated. Re-adjusting answer. – astrochun Mar 24 '21 at 14:32
-
--platform require `--only-binary=:all: or --no-deps ` , download will failed when the package does not have binary version. Finally, i create the same environment to download package for offline server. – roamer Mar 25 '21 at 07:57
-