问题:
在python2.7环境下进行sklearn-poter模块的安装的时候报错如下:
解决方法1:(未尝试)
遇到错查度娘,建议升级:
升级pip:python -m pip install --upgrade pip
升级setuptools:python -m pip install --upgrade setuptools
需要安装Visual C++ 14.0 ~.~
本人感觉有点繁琐啊!大家想尝试转参考连接:https://zhuanlan.zhihu.com/p/89858202
新的解决方法:
吐血建议:要多看看自己的报错,不要只看最后一行就跟着网上的解决方案一顿乱搞。
看完报错之后感觉应该是安装源的问题,于是换了安装源为豆瓣,但是还报同样的错误;
于是下载源代码进行安装:https://github.com/nok/sklearn-porter
(1)解压
(2)cd 到解压好的目录下
(3)python setup.py install
进行源码安装的时候继续报错:通过改代码进行修复吧~~~
参考:https://blog.csdn.net/a1007720052/article/details/80745135
python2 解决TypeError: 'encoding' is an invalid keyword argument for this function
环境:python2.7
代码示例:
with open('1.txt','r',encoding='utf-8') as f:
lines = f.readlines()
for line in lines:
line =line.strip()
使用with open() as f 语句提示错误:
TypeError: 'encoding' is an invalid keyword argument for this function
解决办法:
找到报错的源码,对源码中报错的地方进行修改:
import io
with io.open('1.txt','r',encoding='utf-8') as f:
lines = f.readlines()
for line in lines:
line =line.strip()
安装成功!!!!!!!!!!!!!!