網頁

2020年3月9日 星期一

Mac執行tensorflow發生RuntimeError: dictionary changed size during iteration

問題:
Homebrew的python3版本是3.7.3
在執行tensorflow時出現以下

.
.
.
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py", line 48, in getlines
    for mod in sys.modules.values():

RuntimeError: dictionary changed size during iteration

解決:
$ sudo vi /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py

第48行改成
for mod in list(sys.modules.values()): # for mod in sys.modules.values():



參考
http://www.kaierlong.me/blog/post/kaierlong/tensorflow-2.0-%E9%94%99%E8%AF%AF-RuntimeError-dictionary-changed-size-during-iteration

沒有留言:

張貼留言