错误:由于环境错误而无法安装软件包:Matplotlib的[Errno 13]

时间:2019-06-01 22:45:14

标签: python matplotlib pip upgrade

我正在尝试升级matplotlib:

  var validator = require('../../lib/validator'),
      Schema    = mongoose.Schema,
      Client;

  Client = new Schema({
    name  :  {
      type     : String,
      validate : [validator({
        length: {
          min : 2,
          max : 100
        }
      }), "name"],
      required : true
    },
    email : {
      type     : String,
      validate : [validator({
        isEmail : true,
        length  : {
          min : 7,
          max : 100
        }
      }), "email"],
      unique   : true,
      required : true
    },
    born  :  {
      type : Date,
      validate : [validator({
        minAge : 18
      }), "born"],
      required : true
    },
    company : {
      type     : String,
      validate : [validator({
        length: {
          min : 5,
          max : 100
        }
      }), "company"],
      required : true
    },
    photo: {
      type    : Boolean,
      default : false
    }
  });

  // similar to SQL's like
  function like(query, field, val) {
    return (field) ? query.regex(field, new RegExp(val, 'i')) : query;
  }

  Client.statics.search = function search(params, callback) {
    var Model = mongoose.model('Client'),
        query = Model.find();


    like(query, 'name', params.name);
    like(query, 'email', params.email);
    like(query, 'company', params.company);

    query.exec(callback);
  };

  Client.statics.findById = function findById(id, callback) {
    var Model = mongoose.model('Client'),
        query = Model.find();

    if (id.length !== 24) {
      callback(null, null);
    } else {
      Model.findOne().where('_id', id).exec(callback);
    }
  };

  return mongoose.model('Client', Client);
}```

我知道

benjamins-mbp:~ benjamin$ which pip
/Library/Frameworks/Python.framework/Versions/3.6/bin/pip

benjamins-mbp:~ benjamin$ pip list

所以我尝试了

matplotlib            2.1.0  

输出:

benjamins-mbp:~ benjamin$ pip install --upgrade matplotlib

然后

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib-2.1.0.dist-info/RECORD'
Consider using the `--user` option or check the permissions.

但是当我使用benjamins-mbp:~ benjamin$ pip3 install --user matplotlib Requirement already satisfied: matplotlib in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2.1.0) Requirement already satisfied: python-dateutil>=2.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from matplotlib) (2.6.1) Requirement already satisfied: numpy>=1.7.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from matplotlib) (1.16.2) Requirement already satisfied: six>=1.10 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from matplotlib) (1.11.0) Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from matplotlib) (0.10.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from matplotlib) (2.2.0) Requirement already satisfied: pytz in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from matplotlib) (2017.3) 进行检查时,它仍显示pip listmatplotlib版本。这不在2.1.0中。为什么是这样?如何使用virtualenv获得matplotlib v3.1.0

0 个答案:

没有答案