手动安装azure-cli时出错

时间:2019-02-19 13:39:13

标签: azure azure-cli

我正在研究raspberry pi(正在运行树莓派拉伸),我想安装azure-cli工具。

我遵循了本教程:https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest,该教程说明了如何手动安装azure-cli。

我具有先决条件(docker,libffi和openssl)。

但是当我运行此命令时:

3

我遇到以下错误:

$ curl -L https://aka.ms/InstallAzureCli | bash

错误的第一部分(带有c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory #include <ffi.h> ^ compilation terminated. error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1 ---------------------------------------- Command "/home/pi/lib/azure-cli/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-AymY3d/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-GwBn9T/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-7GqUCB/overlay --compile --install-headers /home/pi/lib/azure-cli/include/site/python2.7/cffi" failed with error code 1 in /tmp/pip-install-AymY3d/cffi/ ---------------------------------------- Command "/home/pi/lib/azure-cli/bin/python /home/pi/lib/azure-cli/local/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-7GqUCB/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- setuptools>=18.5 wheel "cffi>=1.8,!=1.11.3; python_implementation != 'PyPy'"" failed with error code 1 in None Traceback (most recent call last): File "/tmp/azure_cli_install_tmp_N09j1y", line 370, in <module> main() File "/tmp/azure_cli_install_tmp_N09j1y", line 356, in main install_cli(install_dir, tmp_dir) File "/tmp/azure_cli_install_tmp_N09j1y", line 140, in install_cli exec_command(cmd) File "/tmp/azure_cli_install_tmp_N09j1y", line 100, in exec_command subprocess.check_call(command_list, cwd=cwd, env=env) File "/usr/lib/python2.7/subprocess.py", line 186, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/pi/lib/azure-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpD9EVQQ', 'azure-cli', '--upgrade']' returned non-zero exit status 1 )出现了几次。

我需要一些帮助来解决此问题。谢谢

2 个答案:

答案 0 :(得分:0)

对于您遇到的问题,我认为这是您的环境问题。好了,您可以将脚本下载到本地Shell脚本中,然后查看其需求。像这样下载:

curl -L https://aka.ms/InstallAzureCli >> installAzureCli.sh

安装如下:

enter image description here

似乎安装取决于python pip。或者,您可以使用以下命令直接下载安装脚本:

curl https://azurecliprod.blob.core.windows.net/install | bash

但是我建议您首先检查您的环境是否已经安装。

答案 1 :(得分:0)

我找到了解决方法。

首先,我下载了此脚本:

    "devDependencies": {
        "@babel/core": "^7.3.3",
        "@babel/preset-env": "^7.3.1",
        "@cypress/snapshot": "^2.0.1",
        "babel-eslint": "^10.0.1",
        "babel-jest": "^24.1.0",
        "babel-plugin-styled-components": "^1.10.0",
        "cross-env": "^5.2.0",
        "cypress": "^3.1.5",
        "eslint": "^5.14.1",
        "eslint-config-airbnb": "^17.1.0",
        "eslint-config-prettier": "^4.0.0",
        "eslint-plugin-import": "^2.16.0",
        "eslint-plugin-jest": "^22.2.2",
        "eslint-plugin-jsx-a11y": "^6.2.1",
        "eslint-plugin-react": "^7.12.4",
        "eslint-plugin-react-hooks": "^1.0.1",
        "husky": "^1.3.1",
        "jest": "^24.1.0",
        "jest-canvas-mock": "^1.1.0",
        "jest-dom": "^3.1.2",
        "next-progressbar": "^1.0.0",
        "nock": "^10.0.6",
        "node-sass": "^4.11.0",
        "nodemon": "^1.18.10",
        "prettier": "1.16.1",
        "pretty-quick": "^1.10.0",
        "react-testing-library": "^5.9.0",
        "redux-mock-store": "^1.5.3",
        "require-all": "^3.0.0"
    }

然后从此脚本中下载python脚本:

$ curl -L https://aka.ms/InstallAzureCli >> installAzureCli.sh

最后我运行了这个脚本:

$ curl https://azurecliprod.blob.core.windows.net/install.py >> installAzureCliPython.py

有效。我与$ sudo chmod +x installAzureCliPython.py $ python3 installAzureCliPython.py 进行了核对。