AttributeError Traceback (most recent call last) Cell In[1], line 4 2 import pickle 3 with open('all_factor.pkl', 'rb') as f: ----> 4 price = pickle.load(f) AttributeError: Can't get attribute '_unpickle_block' on <module 'pandas._libs.internals' from 'C:\\Users\\WWWWWW\\anaconda3\\envs\\pytorch\\lib\\site-packages\\pandas\\_libs\\internals.cp38-win_amd64.pyd'>
时间: 2023-07-21 17:07:15 浏览: 87
这个错误是由于在加载 pickle 文件时发生了错误。具体来说,它表明无法在 'pandas._libs.internals' 模块上获取 '_unpickle_block' 属性。这可能是因为 pickle 文件保存的对象与当前环境中的 pandas 版本不兼容。
解决这个问题的一种方法是确保 pickle 文件与加载它的环境兼容。你可以尝试以下方法:
1. 检查你的 pandas 版本是否与创建 pickle 文件时使用的版本相同。如果不同,尝试使用相同版本的 pandas 运行代码。
2. 如果你无法获取与 pickle 文件创建时相同版本的 pandas,可以尝试使用较新版本的 pandas 运行代码。有时候较新版本的 pandas 可以正确地加载 pickle 文件。
3. 如果你无法更改 pandas 版本,那么可能需要重新生成 pickle 文件。确保使用与加载 pickle 文件时相同版本的 pandas。
希望这些方法能帮助你解决问题!如果还有其他问题,请随时提问。
相关问题
AttributeError Traceback (most recent call last
This error occurs when you try to access an attribute or method that does not exist in the object you are using.
To fix this error, you should check the spelling and syntax of the attribute or method you are trying to access. Make sure that it exists in the object you are using. If you are not sure, you can use the `dir()` function to list all the attributes and methods of the object.
If the attribute or method is supposed to exist but is still giving you an error, it could be a problem with the object itself. In this case, you may need to check the documentation or seek help from the developer community.
AttributeError Traceback (most recent call last) <ipython-input-26-7401c2f31978> in <module>
It seems like you are trying to run some code in Python and getting an `AttributeError`. Can you please provide more information about the error, such as the full traceback and the code that you are running?
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)