简体   繁体   中英

how to download all the python packages mentioned in the requirement.txt to a folder in linux using python idle?

I want to download all the python packages mentioned in the requirement.txt to a folder in Linux. I don't want to install them. I just need to download them.

I want to write a python script that can download all the python packages.

python version is 3.6

list of packages in the requirement.txt

python-ldap==3.2.0
python-libnmap==0.6.2
python-otrs==0.4.3
pytz==2015.4
PyYAML==3.11
query-string==0.0.2
queuelib==1.2.2
redis==2.10.3
requests==2.22.1
requests-aws4auth==0.9
requests-oauthlib==0.5.0
requests-toolbelt==0.5.0
scp==0.10.2
six==1.10.0
South==1.0.1
tlslite==0.4.9
u-msgpack-python==2.1
urllib3==1.14
w3lib==1.12.0
websockets==3.3
Werkzeug==0.10.4
xlrd==1.0.0
XlsxWriter==1.0.5
zope.interface==4.1.2
GitPython==2.1.3
import subprocess
import sys
command = [
    sys.executable,
    '-m',
    'pip',
    'download',
    '--dest',
    'path/to/target',
    '--requirement',
    'path/to/requirements.txt',
]
subprocess.check_call(command)

References :

Just download the packages?

Then you can use pip command

pip download <package name>==<version>

If you want to make a python script, you can use subprocess

subprocess.check_call([sys.executable, '-m', 'pip', 'download', 
'<packagename>==<version>'])

Usually you'd use:

pip install --target=/path/to/install/to -r requirement.txt

This should download all packages in requirement.txt to the path you specify.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM