如何在CentOS 6.6上安装azure CLI
python -V -> Python 2.6.6 which python -> /usr/bin/python /usr/local/bin/python2.7 -V -> Python 2.7.13 curl -L https://aka.ms/InstallAzureCli | bash
错误:CLI不支持小于2.7的Python版本。
我如何得到上面的脚本来安装Python 2.7。
谢谢
你可以从SCL安装python2.7。 如果你不想构build一些东西或者想在你的CentOS中默认使用python2.6。
# 1. Install a package with repository for your system: # On CentOS, install package centos-release-scl available in CentOS repository: $ sudo yum install centos-release-scl # On RHEL, enable RHSCL repository for you system: $ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms # 2. Install the collection: $ sudo yum install python27 # 3. Start using software collections: $ scl enable python27 bash
更多信息在这里 。
Azure CLI 2.0需要Python 2.7。 我在我的Centos 6.8 VM中testing。 Python 2.6无法升级2.7。 所以,正如Khaled所说,你需要下载python 2.7并安装它。
请参考以下步骤:
yum groupinstall "Development tools" ##If you meet error, ignore it yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel ##download python 2.7 and install it cd /opt wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz tar xf Python-2.7.6.tar.xz cd Python-2.7.6 ./configure --prefix=/usr/local make && make altinstall ##create link ln -sf /usr/local/bin/python2.7 /usr/local/bin/python
然后,你需要编辑$ PATH,把/usr/local/bin到/etc/profile下面
# Path manipulation if [ "$EUID" = "0" ]; then pathmunge /usr/local/bin pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin else
然后source /etc/profile
检查结果。
[root@shui bin]# which python /usr/local/bin/python
有关这方面的更多信息,请参阅此链接 。
有多个解决scheme:
/usr/local/bin/python2.7的完整path,以避免调用python时出现任何不明确的地方。 然后,您可以运行修改后的安装脚本。 $PATH环境variables中的一个位置。 所以,将会使用第一个实例来引用更新的版本。