由于paramiko 2.0将其依赖性从pycrypto更改为加密,因此通过pip安装最新的Ansible失败。密码学依赖于cffi,这需要libffi-dev。有谁知道如何解决这一问题? (Ubuntu Trusty 14.04)
angular
.module('myMod')
.factory('MyService');
MyService.$inject = ['$rootScope', 'atmosphereService', 'atmosphere'];
function MyService ($rootScope, atmosphere) {
return {
subscribe: subscribe,
getMessage: getMessage
};
function subscribe (r) {
var responseParameterDelegateFunctions = ['onOpen', 'onClientTimeout', 'onReopen', 'onMessage', 'onClose', 'onError'];
var delegateFunctions = responseParameterDelegateFunctions;
var result = {};
delegateFunctions.push('onTransportFailure');
delegateFunctions.push('onReconnect');
angular.forEach(r, function (value, property) {
if (typeof value === 'function' && delegateFunctions.indexOf(property) >= 0) {
if (responseParameterDelegateFunctions.indexOf(property) >= 0)
**result[property] = function (response) {**
$rootScope.$apply(function () {
r[property](response);
});
};
else if (property === 'onTransportFailure')
result.onTransportFailure = function (errorMsg, request) {
$rootScope.$apply(function () {
r.onTransportFailure(errorMsg, request);
});
};
else if (property === 'onReconnect')
result.onReconnect = function (request, response) {
$rootScope.$apply(function () {
r.onReconnect(request, response);
});
};
} else
result[property] = r[property];
});
function getMessage () {
var vm = this;
var request = {
url: '/chat',
contentType: 'application/json',
transport: 'websocket',
reconnectInterval: 5000,
enableXDR: true,
timeout: 60000
};
request.onMessage(response); {
vm.$apply (function () {
vm.model.message = atmosphere.util.parseJSON(response.responseBody);
});
}
}
return atmosphere.subscribe(result);
}
}
})(window.angular);
答案 0 :(得分:5)
要从pip安装cryptography >= 1.1
,您需要安装libffi
的开发人员包,因为它将包含缺少的头文件。由于您标记了Ubuntu
,我假设您使用的是apt
包管理器。
apt-get install libffi-dev
您还需要与ssl
开发套件相同的发行版和gcc
cryptography >= 1.1
。如果您在系统环境中运行此操作,则几乎肯定已经安装了gcc
,但如果缺少apt-get install libssl-dev
,则可能还需要libffi-devel
。
Fedora / RHEL等效项为openssl-devel
和dnf
,可以与yum
或var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
app.get('/', function(req, res){
res.sendFile(__dirname + '/index.html');
});
io.on('connection', function(socket){
console.log('a user connected');
socket.on('disconnect', function(){
console.log('user disconnected');
});
});
io.on('connection', function(socket){
socket.on('chat message', function(msg, usn){
io.emit('chat message', msg);
io.emit('chat message', usn);
});
});
http.listen(3000, function(){
console.log('listening on *:3000');
});
一起安装,具体取决于您的操作系统和版本。
答案 1 :(得分:0)
找到一个解决方案是安装每个的特定版本:
pip install paramiko==1.17.0 ansible==2.0.0.2