ModuleNotFoundError: No module named 'tensorflow.python'
after we installed tensorflow, we thought we had debuggable the environment and PIP install tensorflow, if
is entered in CMD
(normally installed the GPU version tensorflow) :
but may be submitted to the above error, on the Internet a lot according to the results there is no use, 😂 is outrageous.
reason (personal summary) : the computer installed multiple python environment, not only the environment, but also anconda, etc., constitute the virtual environment, so you will encounter various problems when using the command conda to assemble the tensflow environment.
the solution: delete other environment, if you remove after the computer did not have the python environment, then reinstall it again, because I have more than one person has them around, “reshipment can solve the problem of ninety-nine percent”, but if pycharm with few words, I do not recommend to assemble anconda, unloading directly, in python’s official website to download the new version of python. After that, tensorFlow is assembled in the whole large Python environment; With the PIP command, there is little problem with reloading.
after installed, we can run the minist a piece of code: </ p>
from tensorflow.examples.tutorials.mnist import input_data #加载数据集，参数为下载的路径，如果该路径下没有数据集的话，则会从网上自动下载。 #read_data_sets函数 mnist = input_data.read_data_sets("E:\\桌面\\datatest") # 打印训练数据大小 print("Training data size:", mnist.train.num_examples) # 打印验证集大小 print("Validating data size:", mnist.validation.num_examples) # 打印测试集大小 print("Testing data size:", mnist.test.num_examples) # 打印训练样例 print("Example training data", mnist.train.images) # 打印训练样例的标签 print("Example training data label:", mnist.train.labels)
, ninety-nine percent of the time will error and remind:
ModuleNotFoundError: No module named 'tensorflow.tutorials'
We first enter the installation environment of tensorflow, and we can find the installation path
through python’s path method
import tensorflow as tf print(tf.__path__)
after entering python environment, type the command and get the path, and then find the path of files
(about) the new version of the tensflow
enter the examples of the first file,
there should be no my red line mark.
go here to download, then copy in the directory, if it is the old version, find the examples file, the effect is the same, after found on the Internet part of the introduction code may also have problems. Note that we must refer to pylab with
from matplotlib import pylab
so, when you’re done, you can run the following code.
from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data", one_hot=True) print ( ' 输入数据：', mnist.train.images) print ( ' 输入数据打shape :', mnist.train.images.shape) from matplotlib import pylab im = mnist.train.images im = im.reshape(-1 ,28) pylab.imshow(im) pylab.show()
- note that our read_data_sets should never be interrupted when downloading data. If they are interrupted, they will report an error if they continue executing later. At this time, either change the path to download again, or find the original download path, delete it and run again.
- The lenet model trained by Python failed to predict its own handwritten pictures
- Mxnet Export onnx Symbol and params files provided are invalid
- ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
- Python RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
- An introduction to sys modules in Python and how packages are imported and used
- How to Solve Python Importerror: DLL load failed: unable to find the specified program using tensorflow
- Tensorflow: Common Usage of tf.get_variable_scope()
- Tensorflow import Error: ImportError: libcuda.so.1: cannot open shared object file: No such file or dire
- The PIP installation package was successful but the import failed
- How to Fix Errors encountered in executing Python scripts with command line parameters
- Python: How to Use os.path.join()
- How to Solve PyInstaller Package Error: ModuleNotFoundError: No module named ‘xxxx‘
- Full explanation of SYS module of Python
- FileNotFoundError: Could not find module ‘D:\Anaconda3\envs\labe\Library\bin\geos_c.dll‘ [Solved]
- Mxnet.gluon Load Pre Training
- How to Solve Error “ImportError: cannot import name imsave“
- Error reading file by pandas pandas.errors.EmptyDataError: no columns to parse from file
- Python 3 uses the relative path import module
- AttributeError: lower not found (NLP extracted tfidf features)
- Python: How to parses HTML, extracts data, and generates word documents