LoginSignup
0
0

More than 3 years have passed since last update.

Netlify+pelicanの静的コンテンツのホスティングで、Pythonのバージョンが3.6だとエラーになる。

Posted at

前書き

NetlifyにPelicanで静的コンテンツをホスティングすること自体は、いろいろなブログやQiitaにも書かれていますので、ここでは割愛します。

指定できるPythonのバージョンの確認方法

Netlifyのドキュメントに、以下のように書かれています。

・/runtime.txt may list a Python version to use from the list of versions preinstalled in your site’s selected build image. Note that the syntax for this file is JUST the version number: x.y, with no trailing newline.

これによると、選択したbuild imageにインストールされているバージョンを/rumtime.txtで指定する必要があるようです。次にbuild imageについて調べます。

build imageについて

build imageはSettingsメニューから、Build & deploy, Continuous Deploymentと辿って開いた画面の真ん中くらいにあるBuild image selectionで指定します。デフォルトではUbuntu Xenial 16.04が選択されているはずです。Ubuntu Trusty 14.04も選択が可能です。

build imegeにインストールされているバージョン

それぞれのbuild imageにインストールされているバージョンは以下のリンク先にかかれています。

これによると、デフォルトで選択されているXenialのbuild imageで指定できるPythonのバージョンは以下の3種類で3.6は入っていません。ついでに他の言語を見ると、Pythonとrubyが変更されているだけで、他は変わらないみたいです。

  • 2.7
  • 3.5
  • 3.7

デフォルト、つまり/runtime.txtで指定されていない場合には、2.7が選択されるようです。/runtime.txtを作成しないで試したところ、pelicanで必要なパッケージの一つであるmore-itertoolsが古いバージョンを指定しないとエラーになりました。あきらめて/runtime.txtで3.7を指定したところ、無事にビルドに成功しました。

0
0
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
0
0