pip install ****.whl
1、pip freeze > requirements.txt
①在C:Users<你的电脑用户名> 新建一个文件夹 pip
②在新建的pip目录新建一个 pip.ini 文件，内容如下
pip wheel -w DIR -r requirements.txt
pip download -d DIR -r requirements.txt
pip install –no-index –find-links=DIR -r requirements.txt
pip download 和 pip wheel 的区别
I’m also curious about this question and the official doc is really ambiguous.
First, with my experiment, the two commands you provided will produce the same output, and the process is quite similar.
But after I read the official doc carefully, I find some options of these two commands is different.
pip download, this command is focus on download packages from somewhere, even it will also try to built it, but it will fallback to download the source packge if it can’t built it. There are some options for you to filter the packages you want to download, even the packages is not compatible with your current environment. like
--implementation, so you can download packges for whatever interpreter you want.
pip wheel, this command is focus on build a wheel for package and it’s dependencies. It provide an optio
--build-option, let you custom the built process. So, with this command you can only download the packages that compatible with your current interpreter and platform.
In my opinion,
pip wheel is more like
pip install than
pip download, cause it can only “download” the packages with current interpreter.
Now for your questions:
- Are then the two commands equivalent? (In this case this would look like replication of instructions, not really a good design principle uncle Guido!)
Ans: For packges compatible with current interpreter, yes, they are almost equivalent, except you want some built options.
- How can I achieve my goal of obtaining the whls required out of my python environment and ignoring any internet ‘index’s?
Ans: Both command can download from local index or a local directory, but if you want packages for other platform,
pip download is needed. In your situation, you may create your own index or a directory holds all packages you needed and install from there every time.
Expect more precise answers.