代码之家  ›  专栏  ›  技术社区  ›  Si Mon

在heroku上部署python flask应用程序时出现functools32错误

  •  6
  • Si Mon  · 技术社区  · 7 年前

    git push heroku master
    Counting objects: 7036, done.
    Compressing objects: 100% (3933/3933), done.
    Writing objects: 100% (7036/7036), 10.97 MiB | 338.00 KiB/s, done.
    Total 7036 (delta 2020), reused 7021 (delta 2014)
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    remote: -----> Python app detected
    remote: -----> Installing python-3.6.2
    remote: -----> Installing pip
    remote: -----> Installing requirements with pip
    remote:        Collecting aniso8601==1.2.1 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 1))
    remote:          Downloading aniso8601-1.2.1.tar.gz (62kB)
    remote:        Collecting click==6.7 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 2))
    remote:          Downloading click-6.7-py2.py3-none-any.whl (71kB)
    remote:        Collecting cycler==0.10.0 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 3))
    remote:          Downloading cycler-0.10.0-py2.py3-none-any.whl
    remote:        Collecting deap==1.0.2.post2 (from -r 
    remote:        Collecting Flask==0.12.2 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 5))
    remote:          Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
    remote:        Collecting Flask-RESTful==0.3.6 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 6))
    remote:          Downloading Flask_RESTful-0.3.6-py2.py3-none-any.whl
    remote:        Collecting functools32==3.2.3.post2 (from -r /tmp/build_3d7108e037a9a8803be5100bdc092768/requirements.txt (line 7))
    remote:          Downloading functools32-3.2.3-2.zip
    remote:            Complete output from command python setup.py egg_info:
    remote:            This backport is for Python 2.7 only.
    remote:            
    remote:            ----------------------------------------
    remote:        Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-l0v0636d/functools32/
    remote:  !     Push rejected, failed to compile Python app.
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy...
    remote: 
    remote: !   Push rejected to XXXXXXX (servername by Heroku).
    remote: 
    

    在我的虚拟盒子上,如果我这样做,一切都很好

    pip install -r requirements.txt
    

    • 更改functools32版本
    • 从需求文本中删除functools,这让我意识到这是装饰器对Flask的依赖:(
    1 回复  |  直到 7 年前
        1
  •  1
  •   Si Mon    7 年前

    回答(感谢评论): 我没有意识到我在我的virtualenv中使用了python 2.7(同样,我是个初学者)。似乎在某处使用functools自动安装了functools32包,该包将functools从python 3移植到2。Heroku默认使用python 3,因此functools32可能不可用。

    我现在安装了一个python 3虚拟环境,这要归功于 this post ,将我的帽子从2个端口移植到3个端口,一切都像一个符咒。