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
one hundred and twenty-three trillion and four hundred and fifty-six billion seven hundred and eighty-nine million one hundred and one thousand one hundred and twelve
one hundred and twenty-three trillion and four hundred and fifty-six billion seven hundred and eighty-nine million one hundred and one thousand one hundred and twelve
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.
Install the specified version of the package with PIP.
pip install pandas==x.x.x
Read More:
- ImportError: No module named indexes.base
- Importerror: no module named typing error reporting solution (python2 PIP needs to be backed back from 21)
- Importerror: the perfect solution of no module named CV2!!! (not too good)
- Importerror of Django error: no module named**
- No module named numpy error in Python code
- Error no module named ‘in newly installed Python_ sqlite3‘
- Essay (19) Ubuntu 16 + python2.7 update PIP report error no module named typing
- Error handling method of “no module named ‘stringio’” in Python 3
- Tensorflow operation report error modulenotfounderror: no module named ‘tensorflow. Python. Types’ solution
- About the problem of calling tools library by running Python program under Mac OS X, modulenotfoundererror: no module named ‘tools‘
- ModuleNotFoundError: No module named xxx
- [Solved] ModuleNotFoundError: No module named ‘win32api’
- ModuleNotFoundError: No module named ‘numpy.testing.nosetester‘
- ModuleNotFoundError: No module named ‘tensorboardX‘
- Modulenotfounderror: no module named ‘CV2’ – (version problem)
- Module not found error: the solution to the problem of no module named ‘MySQL’
- How to Fix gdb error: Failed to import the site module,No module named ‘_sysconfigdata_m’
- Processing method of PIP exception no module named ‘pip’
- Module not founderror: no module named ‘nets.ssd‘
- Python error: importerror: DLL load failed: unable to find the specified module solution