Python 脚本无法使用IDLE's subprocess didn't make connection

咩哈哈,总觉得我开始学习Python有点不务正业,但是呢,还是忍不住去学习这么热的预言,哈哈哈,因为总觉得和Swift超级像啊啊啊,所以我就开始啦啦啦啦~

今天在测试Python脚本的时候,突然间发现,脚本不能启动了,还弹出了的警告!!

IDLE’s subprocess didn’t make connection. Either IDLE can’t start a
subprocess or personal firewall software is blocking the connection.

经过数次检查,仍旧未能解决问题,便只能求助万能的度娘了。百度一下,很多人也碰到了同样的问题,解决方法也出来了:

修改C:\python34\Lib\idlelib\PyShell.py文件,搜索use_subprocess,在

def main():函数下面 use_subprocess = True 修改为: use_subprocess = False

百度知道里面是这样回答的,我更改了,果然可以继续运行,But Why???

Python自带的IDLE的特性之一,便是采用了多线程的机制运行程序,根据此方法,很明显是将多线程的机制给关闭了!!处女座附身的我自然不会就这么稀里糊涂下去,出问题的根源还没有找到呢!!

于是我不甘放弃,继续搜索,最后终于在stackoverflow(链接:http://stackoverflow.com/questions/29567051/python-error-idles-subprocess-didnt-make-connection-either-idle-cant-start)上面找到了同样的案例,回答中还给出了出错误的原因!!

It may be a common problem that happens when you have in you current directory a file with same name on one from Python (references : Can’t run Python via IDLE from Explorer [2013] - IDLE’s subprocess didn’t make connection)

It seems it can also happen if you have incorrect environment
variables such as HOMEPATH USERPROFILE (references : Issue 14576:
IDLE: inconsistent use of HOMEDRIVE, HOMEPATH, and USERPROFILE on
Windows)

I’ve found another related question : Python IDLE subprocess error?

My advice if the answer is not there : google may be your friend ! The
3 clues above come from there :-)

居然是因为我的模块名称和Python系统模块重名了(我直接取名叫做 random.py 了)!!真是泪流满面啊,让人哭笑不得的是,我新建的re模块运行后总是会在同一目录下出现名为“random.pyc”的文件,Python中早就移除了将用户自建模块编译成字节码的机制,多了一个文件,我居然没发现,真让人哭笑不得,改名后果然正常了!!!!!!!!!!

推荐文件命名加前缀 如:shx_random.py

有时候度娘不好使,那么使用Google将会更有助于学习哦~~

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值