无法安装Flask-Mail

时间:2016-03-26 10:54:19

标签: python python-2.7 email flask version

当用户在我的网站上注册时,我正在尝试使用Flask发送电子邮件。我使用命令pip install Flask-Mail进行安装。但是,我收到以下可能的版本不匹配错误:

  Downloading/unpacking Flask-mail
  Downloading Flask-Mail-0.9.1.tar.gz (45kB): 45kB downloaded
  Running setup.py (path:/tmp/pip_build_root/Flask-mail/setup.py) egg_info for package Flask-mail
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/Flask-mail/setup.py", line 52, in <module>
        'Topic :: Software Development :: Libraries :: Python Modules'
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__
        _Distribution.__init__(self,attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options
        ep.require(installer=self.fetch_build_egg)
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require
        working_set.resolve(self.dist.requires(self.extras),env,installer))
      File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve
        raise VersionConflict(dist,req) # XXX put more info here
    pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_root/Flask-mail/setup.py", line 52, in <module>

    'Topic :: Software Development :: Libraries :: Python Modules'

  File "/usr/lib/python2.7/distutils/core.py", line 111, in setup

    _setup_distribution = dist = klass(attrs)

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 225, in __init__

    _Distribution.__init__(self,attrs)

  File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__

    self.finalize_options()

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/setuptools/dist.py", line 257, in finalize_options

    ep.require(installer=self.fetch_build_egg)

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 2029, in require

    working_set.resolve(self.dist.requires(self.extras),env,installer))

  File "/usr/local/lib/python2.7/dist-packages/distribute-0.6.28-py2.7.egg/pkg_resources.py", line 592, in resolve

    raise VersionConflict(dist,req) # XXX put more info here

pkg_resources.VersionConflict: (certifi 2016.2.28 (/usr/local/lib/python2.7/dist-packages), Requirement.parse('certifi==2015.11.20'))

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/Flask-mail

任何可能的解决方法?任何帮助将不胜感激。谢谢!

2 个答案:

答案 0 :(得分:1)

避免这类问题的最简单方法是创建virtual environment

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! StackingCell
    let data = stack[indexPath.row]
    cell.stackDeatils = data
    cell.floorNumber_Label.text = data.floorNo
    let floorDetails = data.floorDetails!
        if floorDetails == "NA"{
        cell.floor_View.backgroundColor = UIColor.lightGrayColor()

    }
else {
        for items in floorDetails
        {

            let floorArr = items.1
            cell.floor_View.backgroundColor = UIColor.orangeColor()

            //Number of Units passing value to cell
            cell.secitons = floorArr.count
            for units in floorArr {
                let unit = units.1
                let compName = unit["companyName"].string!
                if compName == "Vacant" {
                    cell.floor_View.backgroundColor = UIColor(red: 94/255, green: 198/255, blue: 162/255, alpha: 1.0)

                }


                }
            }

        }

    }

    let shadowPath = UIBezierPath(rect: cell.floor_View.bounds)
    cell.floor_View.layer.masksToBounds = false
    cell.floor_View.layer.shadowColor = UIColor.blackColor().CGColor
    cell.floor_View.layer.shadowOffset = CGSize(width: 1, height: 0.5)
    cell.floor_View.layer.shadowOpacity = 0.2
    cell.floor_View.layer.shadowPath = shadowPath.CGPath
    return cell

}

CustomTableCell method for adding vertical line to TableViewCell 
var stackDeatils:StackingModel!{
    didSet
    {
       dispatch_async(dispatch_get_main_queue()) {
       self.updateData()
      }
    }

}

func updateData(){
let unit = self.stackDeatils.isUnitsDrawn
if unit == true  {
    self.stackDeatils.isUnitsDrawn = false
    let stack_width = self.floor_View.frame.width
    let stack_height = self.floor_View.frame.height
    xCor = stack_width/CGFloat(self.secitons)
    var x = xCor

    for var i = 1;i < self.secitons; i++ {

        let line = UIView(frame: CGRectMake(x, 0, 2,stack_height))
        line.backgroundColor = UIColor.whiteColor()
        //print(xCor)
        self.floor_View.addSubview(line)
        x += xCor
         }
    }

else {
    print(self.stackDeatils.isUnitsDrawn)

  }

}

现在激活您的虚拟环境

>>>pip install virtualenv

>>>cd my_project_folder
>>>virtualenv venv

现在安装>>>source venv/bin/activate
希望现在它应该在那里工作

如果你完成了工作然后停用了它

pip install Flask-Mail

似乎所有问题都是由于 >>>deactivate 版本冲突

所以尝试从这里下载源代码 https://pypi.python.org/pypi/certifi

从源代码安装

将其解压缩到该文件夹​​并运行此命令

certifi

它应该有效

和平

答案 1 :(得分:0)

如果您没有设置虚拟环境,我建议您先进行设置。如果已经拥有了,则可能需要从终端激活它:

>>>source venv/bin/activate

完成后,只需停用其余命令即可:

>>>deactivate