【发布时间】:2017-07-04 21:58:24
【问题描述】:
这个issue 的重复,但第一个答案是错误的(jq 在 Windows 上受支持),第二个是指brew,所以我猜是 Mac。
窗口
我正在尝试从 Windows 命令行为 python 安装 jq,但出现以下错误,可能是由于缺少 temp\pip-build-rtnhmg\jq\onig-install-5.9.6 文件:
error: [Error 2] The system cannot find the file specified
...和...
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\<USERNAME>\appdata\local\temp\pip-khvjht-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\
有人知道这里出了什么问题吗?在 StackOverflow 和 Google 上的搜索并没有给我太多帮助,而且我对 Windows 不是很好,对 python/pip 还是新手。
这是全文,减去用户名:
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>pip install jq
Collecting jq
Using cached jq-0.1.6.tar.gz
Building wheels for collected packages: jq
Running setup.py bdist_wheel for jq ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d c:\users\<USERNAME>\appdata\local\temp\tmpuvrf_upip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_ext
Executing: ./configure CFLAGS=-fPIC --prefix=c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\onig-install-5.9.6
error: [Error 2] The system cannot find the file specified
----------------------------------------
Failed building wheel for jq
Running setup.py clean for jq
Failed to build jq
Installing collected packages: jq
Running setup.py install for jq ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\<USERNAME>\appdata\local\temp\pip-khvjht-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
Executing: ./configure CFLAGS=-fPIC --prefix=c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\onig-install-5.9.6
error: [Error 2] The system cannot find the file specified
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\<USERNAME>\\appdata\\local\\temp\\pip-build-rtnhmg\\jq\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\<USERNAME>\appdata\local\temp\pip-khvjht-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\<USERNAME>\appdata\local\temp\pip-build-rtnhmg\jq\
尝试安装 pyjq 会产生相同的错误。
我没有嫁给jq:我只需要在python中格式化json数据,jq在命令行上做得很好。如果我应该尝试其他 python 包,请随时推荐它们。如上所述,pyjq 安装失败并出现相同的错误。
更多详情/采取的步骤:
- 我使用的是 Windows 10,并且使用 the steps from here 安装了 python 2.7.13、
setuptools和pip...没有发现任何问题。 - 使用 pip,我已经成功安装了 request 和 jira 等其他 python 包...没有发现任何问题。
- 使用 Chocolatey,我已经成功安装了命令行的 jq,遵循 these steps ... 没有发现任何问题。
- 我尝试过使用常规权限、以管理员身份运行 cmd、启动新的 cmd 会话、重新启动 PC - 但出现相同的错误。
- 尝试安装 pyjq (
pip install pyjq) 会产生同样的错误。 -
在 Mac 上尝试
pip install jq并得到类似的错误:Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/v5/4x0py0ns2td1h69vgllx7dpr0000gn/T/pip-build-DyMoT4/jq/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/v5/4x0py0ns2td1h69vgllx7dpr0000gn/T/pip-i6UKvt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/v5/4x0py0ns2td1h69vgllx7dpr0000gn/T/pip-build-DyMoT4/jq/ 对于 Mac,按照here 建议的步骤,并按照建议成功安装了
setuptools,但pip install jq仍然失败并出现同样的错误。
【问题讨论】:
-
如果有人在 Mac OS 上安装 jq 时遇到问题,请检查您是否安装了所有先决条件:pypi.python.org/pypi/jq
标签: python windows python-2.7 pip jq