在此任务中,我应该访问一个文件夹〜/ Libs / lib 并安装找到的最新版本的pip软件包。
我通过ansible在本地安装pip软件包时出错。
注意:该软件包在ansible外部安装得很好
我的任务
- name: Get latest lib version
find:
paths: "{{ lib_path }}"
patterns: '*.whl'
register: lib_wheels_file
- name: Get latest file
set_fact:
latest_file: "file:///{{ lib_wheels_file.files | sort(reverse=true) | first }}"
become: yes
- name: Install lib
pip:
name: '{{ latest_file }}'
become: yes
lib_path is found under ~/Libs
我得到的错误:
错误:无效的要求:\“ u'woth':False \” \ n“
使用-vvv选项,我得到以下输出:
fatal: [localhost]: FAILED! => {
"changed": false,
"cmd": [
"/usr/local/bin/pip2",
"install",
"file:///{u'uid': 1000",
" u'woth': False",
" u'mtime': 1571862393.0",
" u'inode': 11798916",
" u'isgid': False",
" u'size': 175829",
" u'roth': True",
" u'isuid': False",
" u'isreg': True",
" u'pw_name': u'tb62'",
" u'gid': 1000",
" u'ischr': False",
" u'wusr': True",
" u'xoth': False",
" u'islnk': False",
" u'nlink': 1",
" u'issock': False",
" u'rgrp': True",
" u'gr_name': u'tb62'",
" u'path': u'/home/tb62/Libs/lib/lib-1.4.0-py2-none-any.whl'",
" u'xusr': False",
" u'atime': 1575281633.538627",
" u'isdir': False",
" u'ctime': 1574842250.317574",
" u'wgrp': False",
" u'xgrp': False",
" u'dev': 2065",
" u'isblk': False",
" u'isfifo': False",
" u'mode': u'0644'",
" u'rusr': True}\""
],
"invocation": {
"module_args": {
"chdir": null,
"editable": false,
"executable": null,
"extra_args": null,
"name": [
"file:///{u'uid': 1000",
" u'woth': False",
" u'mtime': 1571862393.0",
" u'inode': 11798916",
" u'isgid': False",
" u'size': 175829",
" u'roth': True",
" u'isuid': False",
" u'isreg': True",
" u'pw_name': u'tb62'",
" u'gid': 1000",
" u'ischr': False",
" u'wusr': True",
" u'xoth': False",
" u'islnk': False",
" u'nlink': 1",
" u'issock': False",
" u'rgrp': True",
" u'gr_name': u'tb62'",
" u'path': u'/home/tb62/Libs/lib/lib-1.4.0-py2-none-any.whl'",
" u'xusr': False",
" u'atime': 1575281633.538627",
" u'isdir': False",
" u'ctime': 1574842250.317574",
" u'wgrp': False",
" u'xgrp': False",
" u'dev': 2065",
" u'isblk': False",
" u'isfifo': False",
" u'mode': u'0644'",
" u'rusr': True}\""
],
"requirements": null,
"state": "present",
"umask": null,
"version": null,
"virtualenv": null,
"virtualenv_command": "virtualenv",
"virtualenv_python": null,
"virtualenv_site_packages": false
}
},
答案 0 :(得分:1)
我找到的解决方案是使用map()函数映射属性。
from keras.applications.vgg16 import VGG16
from keras.models import Model
from keras.layers import Dense
vgg = VGG16(include_top=False, weights='imagenet', input_shape=(), pooling='avg')
x = vgg.output
x = Dense(1, activation='sigmoid')(x)
model = Model(vgg.input, x)
model.summary()