"pip install jq"在Mac和Windows上生成错误

cod*_*fee 8 python windows pip python-2.7 jq

重复这个问题,但第一个答案是错误的(jqWindows支持),第二个答案是brew因为我猜测是Mac.

视窗

我试图jq从Windows命令行安装python,但得到以下错误,可能是由于丢失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\
Run Code Online (Sandbox Code Playgroud)

尝试安装pyjq会产生相同的错误.

我没有和jq结婚:我只需要在python中格式化json数据,jq在命令行上做得很好.如果还有其他python包我应该尝试,请随时推荐它们.如上所述,pyjq安装失败并出现相同的错误.

进一步的细节/步骤:

  • 我在Windows 10上并安装了python 2.7.13,setuptoolspip使用此处的步骤 ...没有注意到任何问题.
  • 使用pip,我已经成功安装了其他python包,例如request和jira ......没有注意到任何问题.
  • 使用chocolatey我已经成功地为命令行安装了jq,遵循这些步骤 ......没有注意到任何问题.
  • 我尝试过使用常规权限,以管理员身份运行cmd,启动新的cmd会话,重新启动PC - 但得到相同的错误.
  • 尝试安装pyjq(pip install pyjq)会产生相同的错误.
  • pip install jq在Mac上尝试并得到类似的错误:

    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,按照此处建议的步骤setuptools并按建议成功安装,但pip install jq仍然失败并出现相同的错误.

ken*_*orb 5

通过安装 pip

按照jq安装步骤进行pip的项目:

安装需要任何构建所需的程序jq。这包括:

  • 自动重新配置

  • 普通的C编译器工具链,例如gcc和make。

  • libtool

  • Python标头。

苹果系统

在macOS上,您需要安装XCode和以下软件包:

brew install autoconf automake libtool
brew install jq
Run Code Online (Sandbox Code Playgroud)

的Linux

您需要安装以下软件包:

yum install autoconf automake libtool python
Run Code Online (Sandbox Code Playgroud)

  • Windows 解决方案也是如此? (11认同)