简体   繁体   English

如何在 Windows 中的 Python 3.9 下 pip install pickle?

[英]How to pip install pickle under Python 3.9 in Windows?

I need the pickle package installed under my Python 3.9 under Windows 10.我需要在 Windows 10 下安装在我的Python 3.9下的pickle包。

What I tried我试过的

When trying with pip install pickle I was getting:尝试使用pip install pickle我得到了:

ERROR: Could not find a version that satisfies the requirement pickle (from versions: none) ERROR: No matching distribution found for pickle错误:找不到满足泡菜要求的版本(来自版本:无)错误:找不到泡菜的匹配发行版

Then I tried the solution suggested in this question using pip install pickle5 but got the following error:然后我使用pip install pickle5尝试了这个问题中建议的解决方案,但出现以下错误:

error: Microsoft Visual C++ 14.0 or greater is required.错误:需要 Microsoft Visual C++ 14.0 或更高版本。 Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/使用“Microsoft C++ 构建工具”获取它: https : //visualstudio.microsoft.com/visual-cpp-build-tools/

I then tried to install the Tool suggested by the error but got same error message after trying again pip install pickle5 .然后我尝试安装错误建议的工具,但在再次尝试pip install pickle5后得到相同的错误消息。

Question

Which is the correct way to install pickle package under Python 3.9 in Windows 10?在 Windows 10 的Python 3.9下安装pickle包的正确方法是什么?

UPDATE更新

There is no need to install pickle module as it comes already installed along with Python 3.x .无需安装pickle模块,因为它已随Python 3.x一起安装。 Just needed to do import pickle and voila!只需要做import pickle和瞧!

For Generalized Summary, for almost all Python versions, you never need to worry for installing 'pickle' as it comes already installed with the python interpreter.对于 Generalized Summary,对于几乎所有 Python 版本,您无需担心安装 'pickle',因为它已经随 Python 解释器一起安装了。
Hence, simple import works:因此,简单的导入工作:

import pickle

In case this doesn't work, refer to Pickle Install Problems on Stack Overflow.如果这不起作用,请参阅 Stack Overflow 上的Pickle 安装问题
Another suggested way is to run: pip install pickle-mixin另一种建议的方法是运行: pip install pickle-mixin

For other Queries and Info, refer to Python Pickle Documentation .对于其他查询和信息,请参阅Python Pickle 文档

Cedric UPDATED answer is right.塞德里克更新的答案是正确的。 Pickle exists within Python 3.9. Pickle 存在于 Python 3.9 中。 You don't need pip install pickle.您不需要 pip install pickle。 Just use it.就用它。

import pickle

I found a way that I'm not sure it's the optimal but it works.我找到了一种方法,我不确定它是否是最佳的,但它有效。

I did pip install pickle4我做了pip install pickle4

And then in the script just然后在脚本中

import pickle4 as pickle

UPDATE更新

There is no need to install pickle as it's already within Python 3.9 .无需安装pickle因为它已经在Python 3.9 Just needed to import pickle and voila!只需要import pickle ,瞧!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM