Skip to main content
 首页 » 编程设计

python之我无法在 heroku 上部署我的 flask 应用程序

2025年05月04日6me-sa

我是 heroku 的新手,我正试图在那里部署我的应用程序。但它失败了,我收到以下消息:

   Command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__ 
   file__='/tmp/pip_build_u21590/matplotlib/setup.py';exec(compile(getattr(tokenize 
, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" inst 
all --record /tmp/pip-4IJQX6-record/install-record.txt --single-version-external 
ly-managed --compile failed with error code 1 in /tmp/pip_build_u21590/matplotli 
b 
Traceback (most recent call last): 
File "/app/.heroku/python/bin/pip", line 9, in <module> 
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')() 
File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/ 
__init__.py", line 185, in main 
return command.main(cmd_args) 
File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/ 
basecommand.py", line 161, in main 
text = '\n'.join(complete_log) 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 70: ordinal 
not in range(128) 
 
!     Push rejected, failed to compile Python app 
 
To git@heroku.com:salty-oasis-2440.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'git@heroku.com:salty-oasis-2440.git' 

上面是我的要求列表:

  • flask ==0.10.1
  • configobj==5.0.0
  • unicorn ==19.1.1
  • itsdangerous==0.24
  • jinja2==2.7.2
  • matplotlib==1.3.1
  • networkx==1.8.1
  • numpy==1.8.1
  • pyparsing==1.5.7
  • python-dateutil==2.2
  • werkzeug==0.9.4

我做错了什么?

提前致谢!!!

请您参考如下方法:

这不是 Heroku 的问题。这是 known issue with pip有一个未发布的(截至 2014 年 11 月 26 日)修复。由于您使用的是 Python 2.7,您可以 manually patch pip现在。