[英]How to automatically install the most common python packages?
I'm getting tired or installing the same 20 or 30 python packages all the time.我一直在安装相同的 20 或 30 个 python 包,我感到很累。 Is there an off the shelf way to batch install all the most common python tools in one go?是否有现成的方法可以在一个 go 中批量安装所有最常见的 python 工具? I know I can write my own bash script, but I would prefer something curated that I don't have to maintain by myself.我知道我可以编写自己的 bash 脚本,但我更喜欢无需自己维护的策划。
Automatically install the most common packages ?自动安装最常用的软件包? No.*不。*
Semi -Automatically install a certain set of packages ?半自动安装一组包? Yes.是的。
requirements.txt
(or anything you prefer).创建一个新文件夹并创建一个名为requirements.txt
的文件(或任何您喜欢的文件)。python -m pip download -r requirements.txt
.然后运行python -m pip download -r requirements.txt
。
python -m pip install -r requirements.txt
. for each new Python install, open a command prompt, go to the folder and type python -m pip install -r requirements.txt
..bat
) files or shell scripts.您甚至可以将这两个命令放在单独的批处理 ( .bat
) 文件或 shell 脚本中。 So you can just 'double-click' them to execute.因此,您只需“双击”它们即可执行。python -m pip install --upgrade -r requirements.txt
.每周一次,或者您喜欢的任何周期,运行第一个命令以获取最新版本,然后运行命令: python -m pip install --upgrade -r requirements.txt
。(Another option): (另外的选择):
python -m pip install package1 package2 package3... packageN
for each new install.对于每个新安装,复制粘贴一个长命令,例如python -m pip install package1 package2 package3... packageN
。PS. PS。 You almost never actually need all those many packages, and should use a Virtual Env per project.你几乎从不需要这么多包,每个项目都应该使用一个虚拟环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.