解决 RuntimeWarning: Parent module '...' not found while handling absolute import

来源:互联网 发布:如何看待校园暴力 知乎 编辑:程序博客网 时间:2024/05/06 13:35

Pycharm 升级到 2016.3 以后运行 unittest 报错。

报错信息:

RuntimeWarning: Parent module '...' not found while handling absolute import  import sysRuntimeWarning: Parent module '...' not found while handling absolute import  import timeRuntimeWarning: Parent module '...' not found while handling absolute import  import unittest    

这是一个已知问题,从2016.2版本就存在,目前为止还没解决。BUG

目前的解决办法是使用旧的utrunner.py替换新的utrunner.py

解决办法:

STEP1. 打开 pycharm 目录

open /Applications/PyCharm\ CE.app/Contents/helpers/pycharm

STEP2. 下载旧的utrunner.py

STEP3. 用旧的utrunner.py替换pycharm目录下的utrunner.py

然后问题解决。

1 0
原创粉丝点击