磨人的小妖精
凯旋的铁铁
咸鱼一号
展开
-
python报错ModuleNotFoundError: No module named 'cPickle'
在python3.x下使用如下代码:import cPickle as pk会报如下错误:ImportError: No module named ‘cPickle’原因:python2有cPickle,但是在python3下,是没有cPickle的;解决办法:将cPickle改为pickle即可,代码如下:import pickle as pkpython编程需要格外注意pytho...转载 2020-04-21 09:31:19 · 6380 阅读 · 0 评论 -
jupyter notebook 报错AttributeError: module 'matplotlib' has no attribute 'subplots'
1.确定正常安装了matplotlib2.import matplotlib.pyplot as plthttps://blog.csdn.net/qq_42273575/article/details/88118404原创 2020-04-01 11:39:18 · 4497 阅读 · 0 评论 -
ValueError: Found input variables with inconsistent numbers of samples: [404, 102]
问题原代码from sklearn.linear_model import LinearRegressionlr = LinearRegression()lr.fit(x_train, y_train)pre_test = lr.predict(x_test)pre_test = lr.predict(x_train)报错ValueError: Found input vari...原创 2020-03-02 17:01:17 · 23972 阅读 · 6 评论 -
TypeError: unsupported format string passed to numpy.ndarray.__format__
a_ = np.array([12]).reshape(-1, 1)a = model.predict(a_)print("预测一张12英寸的披萨:{:.2f}".format(a))报错:TypeError: unsupported format string passed to numpy.ndarray.format传递给numpy.ndarray.__format__的不支持的...原创 2020-02-15 16:55:08 · 21499 阅读 · 2 评论 -
ValueError: Expected 2D array, got 1D array instead
x_train = np.array([6, 8, 10, 14, 18])y_ = np.array([7, 9, 13, 17.5, 18])model.fit(x_train, y_)错误ValueError: Expected 2D array, got 1D array instead期望2维数组,输入的是一维数组Reshape your data either using...原创 2020-02-15 16:28:04 · 21051 阅读 · 1 评论 -
解决:FileNotFoundError: [Errno 2] File b'E:/AI_learning/data/Ottto_train.csv' does not exist: b'
可能错误:1.文件路径错误:dpath = 'E:\AI_learning\data\'解决:dpath = 'E:/AI_learning/data/'或dpath = 'E:\\AI_learning\\data\\'2.拼写错误原创 2019-12-24 10:36:57 · 8096 阅读 · 0 评论 -
sklearn.model_selection.train_test_split
官方文档:https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html看完以后 不太理解参数random_state怎么起作用的random_state:是随机数的种子。随机数种子:其实就是该组随机数的编号,在需要重复试验的时候,保证得到一组一样的随机数。比如你...原创 2019-11-21 22:53:21 · 116 阅读 · 0 评论 -
Jupter Notebook 快捷键总结
Jupter Notebook 快捷键总结命令模式(按键 Esc 开启)Enter : 转入编辑模式Shift-Enter : 运行本单元,选中下个单元Ctrl-Enter : 运行本单元Alt-Enter : 运行本单元,在其下插入新单元Y : 单元转入代码状态M :单元转入markdown状态R : 单元转入raw状态1 : 设定 1 级标题2 : 设定 2 级标题3 :...原创 2019-11-17 09:49:04 · 213 阅读 · 0 评论 -
tf2.0版本基础上用conda搭建虚拟环境tf1.14
conda搭建python虚拟环境tf2.0版本,有些问题无法解决,用conda创建虚拟环境安装tf1.14conda搭建python虚拟环境 虚拟环境的作用 具体创建流程 在pycharm中使用conda虚拟环境 在conda虚拟环境使用jupyter notebook 删除虚拟环境虚拟环境的作用如果在一台电脑上,想开发多个不同的项目,需要用到同一工具库的不同版本,如果安装或更新特定版 ...原创 2019-11-16 16:09:37 · 2090 阅读 · 3 评论 -
使用anaconda安装tensorflow (windows10环境)以及一些坑
1.使用anaconda安装tensorflow (windows10环境)2.ImportError: No module named ‘tensorflow’解决原创 2019-11-16 15:42:12 · 125 阅读 · 0 评论 -
磨人小妖精-tensorflow之no attribute 'global_variables_initializer'
TensorFlow ‘module’ object has no attribute ‘global_variables_initializer’将tf.global_variables_initializer()改成tf.initialize_all_variables()注意!!!一定要加()原创 2019-11-07 22:16:47 · 2403 阅读 · 2 评论 -
磨人***-ImportError: Missing optional dependency 'xlrd'.或requirement already satifued:xlrd
错误:ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.导入错误:缺少可选的依赖项’xlrd’。安装xlrd >= 1.0.0(用于Excel支持)使用pip或conda安装xlrd。解决方...原创 2019-11-14 22:17:32 · 7201 阅读 · 0 评论 -
磨人小妖精-tensorflow之CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
错误:I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2原因是下载TensorFlow的版本不支持cpu的AVX2编译。可能是因为安装时使用的pip inst...原创 2019-11-08 14:35:39 · 140 阅读 · 0 评论 -
磨人小妖精-tensorflow之removed in a future version
问题1:deprecated and will be removed in a future version.WARNING:tensorflow:From <ipython-input-2-0d6f173b16c0>:6: read_data_sets (from tensorflow.contrib.learn.python.learn.datasets.mnist) is d...原创 2019-11-08 14:17:52 · 853 阅读 · 0 评论 -
磨人小妖精-tensorflow之Can not convert a function into a Tensor or Operation.
TypeError: Can not convert a function into a Tensor or Operation.将tf.global_variables_initializer()改成tf.initialize_all_variables原创 2019-11-07 22:18:46 · 909 阅读 · 0 评论