The whole python third-party library numpy module 'pickle' has no attribute 'load'

This morning, I watched the actual combat of machine learning. When I saw the installation of numpy, I thought that I had already installed it and used it before. As a result, I found an error when I imported numpy on the command line.

module 'pickle' has no attribute 'load'

And it is not that the current module name and the imported module name that often appear on the Internet repeat this problem. Because I haven't named and written the pickle module myself at all. So in the command line, first python, then import pickle, help(pickle), find the location of the pickle module: E/Python/Lib below, I feel that there should be no problem, the program written by myself will not be placed here. Open it up and take a look, it's astonishingly simple,


Well, it would be hell if this had a load method. So let's see what the pickle modules of YL and NJ look like. Copy _pickle.py from YL, replace the pickle module in the above directory, and run it. It's normal on the command line and in pycharm. Kind of weird why _pickle.py.

I copied pickle.py from NJ and replaced my own Li Gui pickle.py, and it all works fine.

Experience:

1. Don't be nervous, scalp numb, affect thinking

2. It reports this error, it is this error, it really does not have this attribute

3. My intuition is accurate, especially when I'm in a hurry

Doubtful things:

1. If I replace the pickle.py module myself like this, will I bury other mines for myself?

2. The two files _pickle.py and pickle.py of YL and NJ can successfully replace my pickle.py, but these two files are different. I save these two files in E:\python tripartite library\Yongli Na Jiao's pickle is under this path

3. When did I make pickle.py so simple. Probably inadvertently changed.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324683090&siteId=291194637