且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有没有一种方法可以使用pip一次安装所有python模块?

更新时间:2023-02-25 13:33:55

我强烈建议您不要这样做-压倒性的***实践是使用requirements.txt文件,列出要具体安装的软件包.

I highly recommend against doing this - the overwhelmingly supported best practice is to use a requirements.txt file, listing the packages you want to install specifically.

然后使用pip install -r requirements.txt安装它,并为您的项目安装所有软件包.

You then install it with pip install -r requirements.txt and it installs all the packages for your project.

这有几个好处:

  • 通过仅安装必需的软件包来实现可重复性
  • 简洁

但是,如果您确实要安装所有python软件包(请注意有成千上万个),则可以通过以下方式进行安装:

However, if you really do want to install ALL python packages (note that there are thousands), you can do so via the following:

点子搜索* | grep)[[:: space:]]" |切-f1 -d"

pip search * | grep ")[[:space:]]" | cut -f1 -d" "

我强烈建议您不要这样做,因为它可能会对您的系统造成可怕的影响,因为它会尝试安装每个python软件包(以及为什么将其安装在剧透标签中).

I strongly recommend against this as it's likely to do horrible things to your system, as it will attempt to install every python package (and why it's in spoiler tags).