出くわしたエラー
状況
VSCodeからDebugをStartしてアプリを起動した際、以下のエラーが出た。
なお、アプリの起動・挙動には問題なし。
エラー内容
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
原因
そもそもこれはpythonのエラーであり、flutterのエラーではない。
なぜ発生したか。
flutterのインストール後にflutter doctor
を叩き、
「✗ Missing Xcode dependency: Python module "six".
」というメッセージが出たので、
brewでpythonをダウンロードしたのだが、それが原因だったぽい。(たぶん競合)
解決策
brew remove python@2 --ignore-dependencies
でいけた。
念のため、flutter doctor
を叩いて問題がないことを確認する。
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.3.2, on Mac OS X 10.13.4 17E202, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3.1)
[✓] Android Studio (version 3.1)
[✓] VS Code (version 1.22.2)
[✓] Connected devices (1 available)
• No issues found!