encoding‘ is an invalid keyword argument for this function

error:TypeError: 'encoding' is an invalid keyword argument for this function

首先查看python版本

python -V:
python=2.7!  

如果python2.7的话encoding的版本和编码都不匹配需要切换成python3.7环境
(如果有conda环境,直接切换python版本为3.7的环境 – conda activate XXX)

pip uninstall python==2.7  or conda uninstall python==3.7

使用pip list 查看是否卸载成功

pip list  or conda list    

如果list中无python版本

pip install python==3.7   or   conda install python==3.7

再次使用list查看环境中python版本

如果python版本切换成功

这时运行程序,程序正常运行。

猜你喜欢

转载自blog.csdn.net/qq_49838648/article/details/124606526
今日推荐