我正在尝试在我的Python 3.4程序中使用这个jq python模块。我想解析从REST API返回的JSON。我在命令行上使用了jq并且它工作得很好,所以我认为使用我找到的这个Python绑定是个好主意。但是,我在Debian Jessie机器上安装模块时遇到了问题。
这是我想要的包裹:
https://pypi.python.org/pypi/jq
这是我运行pip3 install jq
时的输出:
root@deb:~/Downloads# pip3 -vvv install jq
Collecting jq
1 location(s) to search for versions of jq:
* https://pypi.python.org/simple/jq/
Getting page https://pypi.python.org/simple/jq/
Looking up "https://pypi.python.org/simple/jq/" in the cache
Current age based on date: 351
Freshness lifetime from max-age: 600
Freshness lifetime from request max-age: 600
The response is "fresh", returning cached response
600 > 351
Analyzing links from page https://pypi.python.org/simple/jq/
Found link https://pypi.python.org/packages/49/e3/7e61310ac490f52ea3c58669059d6d374c339b70babc43289ab4e5284f29/jq-0.1.3.tar.gz#md5=17e5ea3b04b44a66e5cd394a3fb0cde2 (from https://pypi.python.org/simple/jq/), version: 0.1.3
Found link https://pypi.python.org/packages/6e/a5/b5e87cf3a7fb0e4b13190f2dd10441ddf44df427420ff48e85a2873ee76f/jq-0.1.4.tar.gz#md5=3be49987665648b0232148aa55181bd0 (from https://pypi.python.org/simple/jq/), version: 0.1.4
Found link https://pypi.python.org/packages/82/0c/bf3f544f850cef19f4468bea93e4d0aa908e0d8c601609ba1ed561b42c79/jq-0.1.6.tar.gz#md5=5a5fd1d5bbd592a1e987740289c859c9 (from https://pypi.python.org/simple/jq/), version: 0.1.6
Found link https://pypi.python.org/packages/a1/e3/00bde129cb6e2bd51cb1f86dadf15c628f077a1881224188d5d4954f6278/jq-0.1.2.tar.gz#md5=8f182b2d92f02d498713d64636cbce9c (from https://pypi.python.org/simple/jq/), version: 0.1.2
Found link https://pypi.python.org/packages/b4/6d/a9e4ce7a3aa3762567530fb6daaaba770710937ac20d425b3b79fbfdff45/jq-0.1.5.tar.gz#md5=5427a8c60668962d279882c3ef467f0c (from https://pypi.python.org/simple/jq/), version: 0.1.5
Found link https://pypi.python.org/packages/da/07/9bee593118186d049ab6c62117ff55a9a9807970280bb91bc7690b4df295/jq-0.1.1.tar.gz#md5=f71a002f36f111d644bdda46c4f2eb18 (from https://pypi.python.org/simple/jq/), version: 0.1.1
Found link https://pypi.python.org/packages/f9/f8/13737001ce6cd1e628f767cda920efe815e256b4518f7d452c6e495ecc15/jq-0.1.0.tar.gz#md5=72ff8950d769d43ac78ff1c6d31c23a5 (from https://pypi.python.org/simple/jq/), version: 0.1.0
Using version 0.1.6 (newest of versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6)
Looking up "https://pypi.python.org/packages/82/0c/bf3f544f850cef19f4468bea93e4d0aa908e0d8c601609ba1ed561b42c79/jq-0.1.6.tar.gz" in the cache
Current age based on date: 20278
Freshness lifetime from max-age: 31557600
The response is "fresh", returning cached response
31557600 > 20278
Using cached jq-0.1.6.tar.gz
Downloading from URL https://pypi.python.org/packages/82/0c/bf3f544f850cef19f4468bea93e4d0aa908e0d8c601609ba1ed561b42c79/jq-0.1.6.tar.gz#md5=5a5fd1d5bbd592a1e987740289c859c9 (from https://pypi.python.org/simple/jq/)
Running setup.py (path:/tmp/pip-build-rppc1fh7/jq/setup.py) egg_info for package jq
Running command python setup.py egg_info
running egg_info
creating pip-egg-info/jq.egg-info
writing top-level names to pip-egg-info/jq.egg-info/top_level.txt
writing dependency_links to pip-egg-info/jq.egg-info/dependency_links.txt
writing pip-egg-info/jq.egg-info/PKG-INFO
writing manifest file 'pip-egg-info/jq.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/jq.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pip-egg-info/jq.egg-info/SOURCES.txt'
Source in /tmp/pip-build-rppc1fh7/jq has version 0.1.6, which satisfies requirement jq from https://pypi.python.org/packages/82/0c/bf3f544f850cef19f4468bea93e4d0aa908e0d8c601609ba1ed561b42c79/jq-0.1.6.tar.gz#md5=5a5fd1d5bbd592a1e987740289c859c9
Building wheels for collected packages: jq
Running setup.py bdist_wheel for jq ... Destination directory: /tmp/tmp5lqhtjtmpip-wheel-
Running command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-rppc1fh7/jq/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp5lqhtjtmpip-wheel- --python-tag cp34
running bdist_wheel
running build
running build_ext
Executing: ./configure CFLAGS=-fPIC --prefix=/tmp/pip-build-rppc1fh7/jq/onig-install-5.9.6
当它到达关于安装Oniguruma的最后一行时,它会冻结超过10分钟。
我在top
:
top - 15:37:27 up 1 day, 6:54, 3 users, load average: 0.05, 0.03, 0.05
Tasks: 136 total, 1 running, 135 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.2 us, 0.1 sy, 0.0 ni, 99.4 id, 0.3 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 1014456 total, 919136 used, 95320 free, 60568 buffers
KiB Swap: 2075644 total, 0 used, 2075644 free. 462572 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
25561 root 20 0 23636 2984 2496 R 0.7 0.3 0:00.23 top
990 mysql 20 0 558176 188352 10576 S 0.3 18.6 2:28.97 mysqld
1 root 20 0 28704 4932 3092 S 0.0 0.5 0:03.86 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 1:00.32 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
7 root 20 0 0 0 0 S 0.0 0.0 1:08.01 rcu_sched
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
9 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
10 root rt 0 0 0 0 S 0.0 0.0 0:00.98 watchdog/0
11 root rt 0 0 0 0 S 0.0 0.0 0:01.08 watchdog/1
12 root rt 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
13 root 20 0 0 0 0 S 0.0 0.0 1:15.96 ksoftirqd/1
15 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/1:0H
16 root rt 0 0 0 0 S 0.0 0.0 0:01.01 watchdog/2
17 root rt 0 0 0 0 S 0.0 0.0 0:00.39 migration/2
18 root 20 0 0 0 0 S 0.0 0.0 2:33.87 ksoftirqd/2
19 root 20 0 0 0 0 S 0.0 0.0 2:09.74 kworker/2:0
20 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/2:0H
21 root rt 0 0 0 0 S 0.0 0.0 0:00.78 watchdog/3
22 root rt 0 0 0 0 S 0.0 0.0 0:00.36 migration/3
23 root 20 0 0 0 0 S 0.0 0.0 3:06.01 ksoftirqd/3
25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/3:0H
26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
27 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
28 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns