"pip install jq"在Mac和Windows上生成错误 [英] "pip install jq" generates errors on Mac and Windows

查看:174
本文介绍了"pip install jq"在Mac和Windows上生成错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

issue 的重复项,但第一个答案是错误的( Windows上支持jq),第二个指的是brew,所以我猜是针对Mac.

Duplicate of this issue, but the first answer there is wrong (jq is supported on Windows) and the second refers to brew so I'm guessing is for Mac.

我正在尝试从Windows命令行为python安装jq,但是可能由于缺少temp\pip-build-rtnhmg\jq\onig-install-5.9.6文件而导致出现以下错误: error: [Error 2] The system cannot find the file specified ...和...

I am trying to install jq for python from the Windows command line, but get the following errors, possibly due to a missing temp\pip-build-rtnhmg\jq\onig-install-5.9.6 file: error: [Error 2] The system cannot find the file specified ... and ...

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来说还是新手.

Does anyone know what's gone wrong here? Searches on StackOverflow and Google aren't giving me much to go on, and I'm not great with Windows and still new to python/pip.

这里是全文,减去用户名:

Here is the full text, minus username:

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会产生相同的错误.

Trying to install pyjq instead generates the same errors.

我不喜欢jq:我只需要用python格式化json数据,jq在命令行上就做得很好.如果还有其他python软件包我应该尝试,请随时推荐它们.但是如上所述,pyjq安装失败,出现相同的错误.

I'm not married to jq: I just need to format json data in python, and jq does a great job on the command line. If there are other python packages I should try instead, please feel free to recommend them. As mentioned above though, pyjq is failing install with the same errors.

更多详细信息/采取的步骤:

  • 我在Windows 10上并且使用这些步骤的要求,成功地在命令行中安装了jq. ..没有发现问题.
  • 我尝试使用常规权限,以管理员身份运行cmd,启动新的cmd会话,然后重新启动PC-但出现相同的错误.
  • 尝试安装pyjq(pip install pyjq)会产生相同的错误.
  • 在Mac上尝试pip install jq并遇到类似错误:

  • I am on Windows 10 and have installed python 2.7.13, setuptools and pip using the steps from here ... no issues noted.
  • Using pip, I have successfully installed other python packages such as request and jira ... no issues noted.
  • Using chocolatey I have successfully installed jq for the command line, following these steps ... no issues noted.
  • I have tried using regular permissions, running cmd as administrator, starting a new cmd session, restarting the PC - but get the same errors.
  • Trying to install pyjq (pip install pyjq) generates the same errors.
  • Tried pip install jq on a Mac and got similar errors:

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仍然失败,并出现相同的错误.

  • for the Mac, followed the steps suggested from here and successfully installed setuptools as suggested, but pip install jq still fails with the same error.

    推荐答案

    通过pip

    安装

    根据pip项目的 jq安装步骤:

    Installing via pip

    As per jq installation steps for pip's project:

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

    Installation requires any programs required to build jq. This includes:

    • 自动重新确认

    • Autoreconf

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

    The normal C compiler toolchain, such as gcc and make.

    libtool

    Python标头.

    macOS

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

    macOS

    On macOS, you need XCode to be installed, and the following packages:

    brew install autoconf automake libtool
    brew install jq
    

    Linux

    您需要安装以下软件包:

    Linux

    You need the following packages to be installed:

    yum install autoconf automake libtool python
    

    这篇关于"pip install jq"在Mac和Windows上生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆