Python2与Python3不同之处
pip3 install configparser
安装成功
仍然会报如下错误
Traceback (most recent call last):
File "code_counter.py", line 4, in <module>
import ConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
原因:
原代码中调用该模块的代码为 import ConfigParser
发现在python3中调用该模块的方式修改为import configparser
即可正常运行。(大小写区别)
在Python2中
import ConfigParser
在Python3中import configparser