前提・実現したいこと
フリーライブラリで学ぶ機械学習入門という本を使って勉強をしているのですが以下のようなエラーメッセージが何が何だかわかりません。改善方法とエラーの内容をどうか教えてください。
発生している問題・エラーメッセージ
File "cell_name", line 5 SyntaxError: from __future__ imports must occur at the beginning of the file
該当のソースコード
Python
1% matplotlib inline 2 3from __future__ import print_function 4 5import copy 6import matplotlib 7import matplotlib.pyplot as plt 8import numpy as np 9import pandas as pd 10 11matplotlib.style.use('ggplot')
試したこと
ライブラリがインストールされていないのではないかと思い、Anacondaを再インストールしました。そのあとライブラリがインストールされているか確認しましたがされていました。
補足情報(FW/ツールのバージョンなど)
Python 3.7
from __future__ imports must occur at the beginning of the file とわかりやすく書いてあると思うのですが読んでいないのですか?
回答1件
あなたの回答
tips
プレビュー