Automatically install the most common packages? No.*
- * (I suppose someone could write a script which checks pypi's stats and downloads & installs them but you'd still need to run the script for each fresh install.)
Semi-Automatically install a certain set of packages? Yes.
- Make a new folder and create a file called
requirements.txt
(or anything you prefer).
- In it, list all the packages you want.
- Start with those 20-30 packages you mentioned, perhaps with version numbers.
- Details on the format of the file here.
- Then run
python -m pip download -r requirements.txt
.
- This will only download the packages to the current folder, not install them.
- Copy that folder to a USB drive
- for each new Python install, open a command prompt, go to the folder and type
python -m pip install -r requirements.txt
.
- You could even put those two commands in separate batch (
.bat
) files or shell scripts. So you can just 'double-click' them to execute.
- And once a week, or whatever cycle you like, run the first command to get the latest versions and then run the command:
python -m pip install --upgrade -r requirements.txt
.
(Another option):
- Copy-paste a long command like
python -m pip install package1 package2 package3 ... packageN
for each new install.
PS. You almost never actually need all those many packages, and should use a Virtual Env per project.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…