我有一个Ansible任务。
但是它出现了错误。
- name: Install setuptools in virtual environment
pip:
name: setuptools-git
virtualenv: "myenv"
virtualenv_command: "/root/.pyenv/bin/pyenv virtualenv 2.7.13"
但是它出现了错误。
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"chdir": null,
"editable": false,
"executable": null,
"extra_args": "",
"name": [
"setuptools-git"
],
"requirements": null,
"state": "present",
"umask": null,
"use_mirrors": true,
"version": null,
"virtualenv": "myenv",
"virtualenv_command": "/root/.pyenv/bin/pyenv virtualenv 2.7.13",
"virtualenv_python": null,
"virtualenv_site_packages": false
}
},
"msg": "Unable to find pip in the virtualenv, myenv, under any of these names: pip2, pip. Make sure pip is present in the virtualenv."
}
当我检查virtualenv中的pip文件时,它已经存在。
# ls -alh /root/.pyenv/versions/myenv/bin/pip
-rwxr-xr-x 1 root root 243 Jan 16 17:40 /root/.pyenv/versions/myenv/bin/pip
同名有两个虚拟环境
# /root/.pyenv/bin/pyenv virtualenvs
2.7.13/envs/myenv (created from /root/.pyenv/versions/2.7.13)
myenv (created from /root/.pyenv/versions/2.7.13)
我无法在virtualenv
变量中使用executable
。
/root/.pyenv/versions/myenv/bin/pip
被符号链接到了2.7.13
? - techraf