Ansible 无法完成,因为 Python 已弃用,即使安装了 Python 3



我正在尝试从谷歌运行LaunchKit以获取一些应用程序屏幕截图。我已经完成了 GitHub 页面 (https://github.com/LaunchKit/LaunchKit( 上开源代码的所有步骤。完成所有步骤并运行$ vagrant up --provision后,我得到以下内容:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' version '20190514.0.0' is up to date...
==> default: Running provisioner: ansible...
Vagrant has automatically selected the compatibility mode '2.0'
according to the Ansible version installed (2.9.2).
Alternatively, the compatibility mode can be specified in your Vagrantfile:
https://www.vagrantup.com/docs/provisioning/ansible_common.html#compatibility_mode
default: Running ansible-playbook...
PLAY [all] *********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [default]
TASK [update apt cache] ********************************************************
ok: [default]
TASK [common : install the unzip tool] *****************************************
ok: [default]
TASK [common : install launchkit dummy service] ********************************
ok: [default]
TASK [common : install vagrant start bug workaround] ***************************
ok: [default]
TASK [common-python : install python dev library] ******************************
ok: [default]
TASK [common-python : install packages for pip crypto] *************************
ok: [default]
TASK [common-python : install packages for ssl] ********************************
ok: [default]
TASK [common-python : install pip] *********************************************
ok: [default]
TASK [common-python : install python virtualenv] *******************************
ok: [default]
TASK [redis : install redis] ***************************************************
ok: [default]
TASK [redis : install redis config] ********************************************
ok: [default]
TASK [postgres : install postgres] *********************************************
ok: [default]
TASK [postgres : install postgres contrib] *************************************
ok: [default]
TASK [postgres : install postgres dev libraries] *******************************
ok: [default]
TASK [postgres : install postgres python library for further ansible configuration] ***
ok: [default]
TASK [postgres : install postgres config] **************************************
ok: [default]
TASK [postgres : install postgres security config] *****************************
ok: [default]
TASK [postgres : install postgres upstart service translation] *****************
ok: [default]
TASK [postgres : add local user as postgres superuser] *************************
ok: [default]
TASK [lk-django : install python lxml library] *********************************
ok: [default]
TASK [lk-django : install jpeg library for pillow] *****************************
ok: [default]
TASK [lk-django : install jpeg-dev library for pillow] *************************
ok: [default]
TASK [lk-django : install db adapter] ******************************************
ok: [default]
TASK [lk-django : upgrade pip] *************************************************
ok: [default]
TASK [lk-django : install python requirements] *********************************
fatal: [default]: FAILED! => {"changed": false, "cmd": ["/usr/local/bin/pip2", "install", "-r", "/vagrant/requirements.txt"], 
"msg": "stdout: Requirement already satisfied: boto==2.38.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 1)) (2.38.0)nRequirement already satisfied:
celery[redis]==3.1.17 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 2)) (3.1.17)nRequirement already satisfied: cssutils==1.0.1
in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 3)) (1.0.1)nRequirement already satisfied: django-bitfield==1.7.1 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 4)) (1.7.1)nRequirement already satisfied:
Django==1.7.3 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 5)) (1.7.3)nRequirement already satisfied: djorm-pgarray==1.2.0 in 
/usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 6)) (1.2)nRequirement already satisfied: dnspython==1.12.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 7)) (1.12.0)nRequirement already satisfied:
fabric==1.10.1 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 8)) (1.10.1)nRequirement already satisfied: hiredis==0.1.5 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 9)) (0.1.5)nRequirement already satisfied: Pillow==3.0.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 10)) (3.0.0)nRequirement already satisfied: premailer==1.3.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 11)) (1.3.0)nRequirement already satisfied: psycopg2==2.5.4 in 
/usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 12)) (2.5.4)nRequirement already satisfied: pycrypto==2.6.1 in /usr/lib/python2.7/dist-packages 
(from -r /vagrant/requirements.txt (line 13)) (2.6.1)nRequirement already satisfied: pylint==0.28.0 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 14)) (0.28.0)nRequirement already satisfied: python-memcached==1.53 in 
/usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 15)) (1.53)nRequirement already satisfied: redis==2.10.3 in /usr/local/lib/python2.7/dist-packages (from -r /vagrant/requirements.txt (line 16)) (2.10.3)nCollecting requests==2.5.3n  Using cached https://files.pythonhosted.org/packages/95/54/44dc83b5f11c6da06bf9abd18c8a0905e0e297e0a9c3bfbc0c6ee4bdd33d/requests-2.5.3-py2.py3-none-any.whlnProcessing 
/root/.cache/pip/wheels/59/10/55/80c2bd162c923de93fbec8237cdceeb795507da2748926850e/SQLAlchemy-0.9.8-cp27-none-linux_x86_64.whlnCollecting tweepy==3.3.0n  Using cached https://files.pythonhosted.org/packages/cd/8b/dfeeb1057d37af810161f8206aa5a6e6e9351dd87ea6f84e4f87d7e3c8a3/tweepy-3.3.0-py2.py3-none-any.whlnProcessing 
/root/.cache/pip/wheels/1f/ea/0a/599a5398012b4e42f32cdfa9101fe35697d3df97282e1da5f3/ua_parser-0.3.6-cp27-none-any.whlnRequirement already satisfied: billiard<3.4,>=3.3.0.19 in /usr/local/lib/python2.7/dist-packages (from celery[redis]==3.1.17->-r /vagrant/requirements.txt
(line 2)) (3.3.0.23)nRequirement already satisfied: pytz>dev in /usr/local/lib/python2.7/dist-packages (from celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) (2019.3)nRequirement already satisfied: kombu<3.1,>=3.0.24 in /usr/local/lib/python2.7/dist-packages (from celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) 
(3.0.37)nRequirement already satisfied: six in /usr/lib/python2.7/dist-packages (from django-bitfield==1.7.1->-r /vagrant/requirements.txt (line 4)) (1.5.2)nRequirement already satisfied: paramiko>=1.10 in /usr/local/lib/python2.7/dist-packages (from fabric==1.10.1->-r 
/vagrant/requirements.txt (line 8)) (2.7.1)nRequirement already satisfied: cssselect in /usr/local/lib/python2.7/dist-packages (from premailer==1.3.0->-r /vagrant/requirements.txt (line 11)) (1.1.0)nRequirement already satisfied: lxml in /usr/lib/python2.7/dist-packages (from premailer==1.3.0->-r /vagrant/requirements.txt (line 11)) (3.3.3)nRequirement already satisfied
: logilab-common>=0.53.0 in /usr/local/lib/python2.7/dist-packages (from pylint==0.28.0->-r /vagrant/requirements.txt (line 14)) (1.4.4)nRequirement already satisfied: logilab-astng>=0.24.3 in /usr/local/lib/python2.7/dist-packages (from pylint==0.28.0->-r 
/vagrant/requirements.txt (line 14)) (0.24.3)nCollecting requests-oauthlib>=0.4.1n  Using cached 
https://files.pythonhosted.org/packages/a3/12/b92740d845ab62ea4edf04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-any.whlnRequirement already satisfied: anyjson>=0.3.3 in /usr/local/lib/python2.7/dist-packages (from kombu<3.1,>=3.0.24->celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) (0.3.3)nRequirement already satisfied: amqp<2.0,>=1.4.9 in /usr/local/lib/python2.7/dist-packages (from kombu<3.1,>=3.0.24->celery[redis]==3.1.17->-r /vagrant/requirements.txt (line 2)) (1.4.9)nRequirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib/python2.7/dist-packages (from paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (3.1.7)nRequirement already satisfied: cryptography>=2.5 in /usr/local/lib/python2.7/dist-packages (from paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (2.8)nRequirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python2.7/dist-packages (from paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.3.0)nRequirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from logilab-common>=0.53.0->pylint==0.28.0->-r /vagrant/requirements.txt (line 14)) (3.3)nCollecting oauthlib>=3.0.0n  Using cached https://files.pythonhosted.org/packages/05/57/ce2e7a8fa7c0afb54a0581b14a65b56e62b5759dbc98e80627142b8a3704/oauthlib-3.1.0-py2.py3-none-any.whlnRequirement already satisfied: cffi>=1.1 in /usr/local/lib/python2.7/dist-packages (from bcrypt>=3.1.3->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.13.2)nRequirement already satisfied: enum34; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.5->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.1.6)nRequirement already satisfied: ipaddress; python_version < "3" in /usr/local/lib/python2.7/dist-packages (from cryptography>=2.5->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (1.0.23)nRequirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=1.10->fabric==1.10.1->-r /vagrant/requirements.txt (line 8)) (2.19)nInstalling collected packages: requests, sqlalchemy, oauthlib, requests-oauthlib, tweepy, ua-parsern  
Found existing installation: requests 2.2.1nn:stderr: /usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning:
Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a release (2.7.7+) that supports hmac.compare_digest as soon as possible.n  utils.PersistentlyDeprecated2018,nDEPRECATION: 
Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for
Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportn/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:380: 
SNIMissingWarning: An HTTPS request has been made, but the SNI (Server Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS
certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-
usage.html#ssl-warningsn  SNIMissingWarning,n/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:139: InsecurePlatformWarning: A true SSLContext object
is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more
information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warningsn  InsecurePlatformWarning,nERROR: tweepy 3.3.0 has requirement six>=1.7.3, but you'll have six
1.5.2 which is incompatible.nERROR: Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only
a partial uninstall.n"}
PLAY RECAP *********************************************************************
default                    : ok=25   changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Python2 的当前版本是 2.7.10(高于它请求的 2.7.7+(,我还安装了 python 3 (3.7.6(。

这是我第一次在终端中深入工作。

我也尝试为 python = python3 创建一个别名,但是当调用 vagrant up 时,它似乎仍在运行 Python2 --provision。

关于如何解决这个问题的任何想法?

TASK [lk-django : install python requirements] ****** 致命:[默认]:失败!=> {"changed": false, "cmd": ["/usr/local/bin/pip2", "install", "-r", "/vagrant/requirements.txt"], ...错误:tweepy 3.3.0 有 6 个要求>=1.7.3,但您将有六个 1.5.2 不兼容。错误:无法卸载"请求"。这是一个distutils安装的项目,因此我们无法准确确定哪些文件属于它,这只会导致 部分卸载。"}

手动卸载冲突的软件包six 1.5.2


可以在带有命令和剧本的托管计算机上使用 Python 3。如果您认为这将解决冲突,请将变量ansible_python_interpreter例如在清单中

ansible_python_interpreter=/usr/bin/python3

应自动选择点子版本。问题由 pip 报告。查看源代码

- name: install python requirements
pip: requirements=/vagrant/requirements.txt

点 说:

默认情况下,它使用 Ansible Python 解释器的 pip 版本。例如,python 3 上的 pip3,python 2 上的 pip2 或 pip。

最新更新