The problem recurred
When I use pickle to reload data, all the errors are as follows:
Traceback (most recent call last):
File "segment.py", line 17, in <module>
word2id = pickle.load(pk)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py", line 1124, in find_class
__import__(module)
ImportError: No module named indexes.base
The reason for this
The same code and data run on two different machines. At first, I thought the wrong machine was missing some Python packages. But there are too many packages to install, so I can’t try them one by one. Fortunately, I use virsualenv to copy the environment from another machine to this machine directly. After running, there is no problem. But in order to find out which Python installation package is missing, I use the original compilation environment, reuse pickle to generate the original data to be loaded, and then reload it At this time, there was no error.
summary
To sum up, the reason is that the original version of panda used in the generation of pickle file is different from the current version of load pickle file. So whether it is to write code in Python or other languages, the compiling environment is very important. Once the version of a package is different, it may also lead to program errors.
Read More:
- Python:ImportError: No module named indexes.base
- Importerror: the perfect solution of no module named CV2!!! (not too good)
- Importerror of Django error: no module named**
- Importerror: no module named typing error reporting solution (python2 PIP needs to be backed back from 21)
- ModuleNotFoundError: No module named xxx
- [Solved] ModuleNotFoundError: No module named ‘win32api’
- How to Fix gdb error: Failed to import the site module,No module named ‘_sysconfigdata_m’
- Module not found error: the solution to the problem of no module named ‘MySQL’
- Module not founderror: no module named ‘nets.ssd‘
- ModuleNotFoundError: No module named ‘numpy.testing.nosetester‘
- Modulenotfounderror: no module named ‘CV2’ – (version problem)
- ModuleNotFoundError: No module named ‘tensorboardX‘
- No module named numpy error in Python code
- Processing method of PIP exception no module named ‘pip’
- ModuleNotFoundError: No module named ‘notebook‘
- Unable to call numpy in pychar, module notfounderror: no module named ‘numpy’
- ModuleNotFoundError: No module named ‘ahocorasick‘ [100% Work Method]
- ModuleNotFoundError: No module named ‘apt_pkg‘
- Error no module named ‘in newly installed Python_ sqlite3‘
- ModuleNotFoundError: No module named ‘MySQLdb‘