我有以下任务失败:
- name: restore dependencies via pipenv
shell: /home/{{ ansible_user }}/.local/bin/pipenv install
args:
executable: /bin/bash
chdir: "{{ app_dir }}"
environment:
LC_ALL=C.UTF-8
LANG=C.UTF-8
带有以下消息:
RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.
This system supports the C.UTF-8 locale which is recommended. You might be able to resolve your issue by exporting the following environment variables:
export LC_ALL=C.UTF-8 export LANG=C.UTF-8
令我惊讶的是环境
是在任务级别设置的。
此外,当我通过 ssh 进入计算机并手动执行操作时,该命令运行正常。
最佳答案
这是任务中的某种拼写错误。正确的语法是:
- name: restore dependencies via pipenv
shell: /home/{{ ansible_user }}/.local/bin/pipenv install
args:
executable: /bin/bash
chdir: "{{ app_dir }}"
environment:
LC_ALL: "C.UTF-8"
LANG: "C.UTF-8"
关于python - Ansible 无法通过 pipelinenv 安装依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58588053/