how to download a package with python-apt?

Luis Daniel

I want to know as title says: how to download a package using python-apt API? Only download it, don't to install it, just like does the command:

apt-get download ${package_name}   

I'm using python v2.7.5-5ubuntu3 with python-apt v0.9.3.5 on Ubuntu 14.04.

Ortomala Lokni

You can use this script

#!/usr/bin/python
import apt
import os, sys

if len(sys.argv) != 2:
    print 'Usage: apt-download pkg_name'
    sys.exit()

cache = apt.Cache()
pkg   = cache[sys.argv[1]]
cmd   = 'wget ' + pkg.candidate.uri
print cmd
os.system(cmd)

It works well with Python 2.7.8 and python-apt 0.9.3.11 but it should also work with your configuration.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

How to install specific gdb (or other) package version using apt-cyg in Cygwin?

来自分类Dev

如何从apt安装Python 3.4.5?

来自分类Dev

How to write in ARFF file using LIAC-ARFF package in Python?

来自分类Dev

确定apt-get install <package>的目标位置?

来自分类Dev

sudo apt-get autoremove package *有多危险?

来自分类Dev

Ubuntu Advanced Package Tool(APT)调用的IP地址是什么

来自分类Dev

apt-cache 策略 <package_name> 是否需要 sudo?

来自分类Dev

我必须在 apt-get purge package_name 之前运行 apt-get remove package_name 吗?

来自分类Dev

How to install Boost.Python on Windows 7 in order to install a python package?

来自分类Dev

如何安装源自apt包的Python绑定?

来自分类Dev

通过apt-get安装python 3.5

来自分类Dev

add-apt-repository引发Python错误

来自分类Dev

无法使用apt,因为python编码问题

来自分类Dev

让Python等待apt-get安装

来自分类Dev

Python问题-apt与2.7 vs 3.5的混淆

来自分类Dev

“ apt-get install <package_name> / testing”和“ apt-get install -t test <package_name>”之间有什么区别?

来自分类Dev

How to find a package in NuGet?

来自分类Dev

Apt-get删除python〜150Mb / apt-get安装python 687kb

来自分类Dev

how to download a stream using ssh?

来自分类Dev

这些apt-package为何在Ubuntu和Heroku上表现不一样?

来自分类Dev

“ apt-cache show package_name”输出中的“任务”是什么?

来自分类Dev

“ apt-cache show package_name”输出中的“任务”是什么?

来自分类Dev

运行`apt source <some_package>`时权限被拒绝提取问题

来自分类Dev

“ apt autoremove --purge <package>”是否还会删除相关软件包的配置文件?

来自分类Dev

“sudo apt-get install <package_name>”从哪里获取软件包?

来自分类Dev

如何指定用户定义的存档目录以运行“apt install ./<package_name>”

来自分类Dev

sudo apt安装python3-pyqt5和其他apt安装方法

来自分类Dev

Debian:安装python软件包:apt-get或apt-src?

来自分类Dev

Python: generate xlsx in memory and stream file download?

Related 相关文章

  1. 1

    How to install specific gdb (or other) package version using apt-cyg in Cygwin?

  2. 2

    如何从apt安装Python 3.4.5?

  3. 3

    How to write in ARFF file using LIAC-ARFF package in Python?

  4. 4

    确定apt-get install <package>的目标位置?

  5. 5

    sudo apt-get autoremove package *有多危险?

  6. 6

    Ubuntu Advanced Package Tool(APT)调用的IP地址是什么

  7. 7

    apt-cache 策略 <package_name> 是否需要 sudo?

  8. 8

    我必须在 apt-get purge package_name 之前运行 apt-get remove package_name 吗?

  9. 9

    How to install Boost.Python on Windows 7 in order to install a python package?

  10. 10

    如何安装源自apt包的Python绑定?

  11. 11

    通过apt-get安装python 3.5

  12. 12

    add-apt-repository引发Python错误

  13. 13

    无法使用apt,因为python编码问题

  14. 14

    让Python等待apt-get安装

  15. 15

    Python问题-apt与2.7 vs 3.5的混淆

  16. 16

    “ apt-get install <package_name> / testing”和“ apt-get install -t test <package_name>”之间有什么区别?

  17. 17

    How to find a package in NuGet?

  18. 18

    Apt-get删除python〜150Mb / apt-get安装python 687kb

  19. 19

    how to download a stream using ssh?

  20. 20

    这些apt-package为何在Ubuntu和Heroku上表现不一样?

  21. 21

    “ apt-cache show package_name”输出中的“任务”是什么?

  22. 22

    “ apt-cache show package_name”输出中的“任务”是什么?

  23. 23

    运行`apt source <some_package>`时权限被拒绝提取问题

  24. 24

    “ apt autoremove --purge <package>”是否还会删除相关软件包的配置文件?

  25. 25

    “sudo apt-get install <package_name>”从哪里获取软件包?

  26. 26

    如何指定用户定义的存档目录以运行“apt install ./<package_name>”

  27. 27

    sudo apt安装python3-pyqt5和其他apt安装方法

  28. 28

    Debian:安装python软件包:apt-get或apt-src?

  29. 29

    Python: generate xlsx in memory and stream file download?

热门标签

归档