LoginSignup
12
9

More than 5 years have passed since last update.

heroku python3 →もしかして: 空白?

Posted at

virtualenvを知ってから、ローカルでpython2とpython3を切り替えたりしながら作業してて楽しい。けれども、pythonのバージョン変えてherokuにdeployするというのをさっき初めてやってみて30分くらいかかったので、今後のためにメモしておく。

目的: python2で作っていたherokuアプリをpython3に変更する。

方法: アプリのルートに"runtime.txt"というファイルを置く。それだけ。中身は、

runtime.txt
python-3.4.2

と書くだけ。

で、はまってたのは一行目を空白で改行してたから!

エラー(一部抜粋)はこんな感じ。

remote: -----> Python app detected
remote: -----> Found runtime python-2.7.9, removing
remote: -----> Installing runtime (
remote: python-3.4.2)
remote:  !     Requested runtime (
remote: python-3.4.2) is not available for this stack (cedar-14).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote: 
remote:  !     Push rejected, failed to compile Python app

バージョン指定を調べ直したり(https://devcenter.heroku.com/articles/python-runtimes)
して、それから空白行に気づいた。慣れないvimで書いてた。

あと、pythonのバージョン変えたらpip freeze > requirements.txtをするのもわすれないこと。

12
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
9