前言:ansible運行報錯python
/usr/lib64/python2.7/site-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
CryptographyDeprecationWarning
環境說明:web
主機名 | 操做系統版本 | python版本 | python3版本 | pip版本 | pip3版本 |
---|---|---|---|---|---|
ansible | Centos 7.6.1810 | Python 2.7.5 | Python 3.6.8 | pip 20.2.2(python 2.7) | pip 20.2.2(python 3.6) |
1、安裝ansible
[root@ansible ~]# yum -y install https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.9.9-1.el7.ans.noarch.rpm
使用yum方式安裝ansible,指定安裝ansible版本爲2.9.9
bash
2、運行ansible
運行ansible時有以下提示微信
[root@ansible ~]# ansible --version
/usr/lib64/python2.7/site-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
CryptographyDeprecationWarning,
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
雖然這個提示不影響使用,可是對於有強迫症的我來講是不可接受的
運維
3、問題解決
1.卸載ansible
[root@ansible ~]# yum remove ansible
2.使用pip3從新安裝ansible
[root@ansible ~]# pip3 install xlrd -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
[root@ansible ~]# mkdir ~/.pip
[root@ansible ~]# touch ~/.pip/pip.conf
[root@ansible .pip]# more pip.conf
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host = pypi.douban.com
[root@ansible .pip]# pip3 install ansible==2.9.9
使用pip3從新安裝ansible,重裝後問題解決
python2.7
更多內容請關注公衆號:Linux運維實踐ide
本文分享自微信公衆號 - Linux運維實踐(gh_11cec8ef4c61)。
若有侵權,請聯繫 support@oschina.cn 刪除。
本文參與「OSC源創計劃」,歡迎正在閱讀的你也加入,一塊兒分享。url