安装问题 - 带有Virtualenv的Flask

时间:2015-05-20 05:21:17

标签: pip virtualenv

我正在尝试使用virtualenv来安装烧瓶。我使用命令

激活virtualenv
$. venv/bin/activate

然后我尝试命令

(venv)$pip install flask

但我收到错误

error: could not create '/usr/local/lib/python2.7/dist-packages/flask': Permission denied

来自1.0(python 2.7)的pip版本/usr/lib/python2.7/dist-packages,virtualenv版本1.7.1.2

1 个答案:

答案 0 :(得分:0)

您没有使用pip中的virtualenv,而是使用系统范围内安装的virtualenv。 这就是dm@Z580:~/workspace$ virtualenv venv New python executable in venv/bin/python Installing setuptools, pip...done. dm@Z580:~/workspace$ source venv/bin/activate (venv)dm@Z580:~/workspace$ which python /home/dm/workspace/venv/bin/python (venv)dm@Z580:~/workspace$ which pip /home/dm/workspace/venv/bin/pip (venv)dm@Z580:~/workspace$ pip --version pip 1.5.6 from /home/dm/workspace/venv/local/lib/python2.7/site-packages (python 2.7)

的样子
function imgLoad(url) {
return new Promise(function(resolve, reject) {

  var request = new XMLHttpRequest({mozSystem: true});
  request.open('GET', url);
  request.responseType='blob';

  request.onload = function() {
    if (request.status >= 200 && request.status < 400) {
      resolve(request.response);
    } else {
      reject(Error('Image did\'t load successfully; error code '+ request.statusText));
    }
  };

  request.onerror= function() {
    reject(Error('There was a network Error'));
  };
  request.send();
});
}

var body = document.querySelector('body');
var myImage = new Image();

imgLoad('http://jsafaiyeh.github.io/img/suw_background.png').then(function response() {
  var imageURL = window.URL.createObjectURL(response);
  myImage.src = imageURL;
  body.appendChild(myImage);
}, function(Error) {
  console.log(Error);
});