导入错误:没有名为 _winreg python3 的模块

发布于 2024-10-05 12:05:54 字数 118 浏览 0 评论 0原文

如果可以的话,我可以在哪里下载 python3 的 _winreg 。我的“windir”位于 E:\Windows 上。不知道cx_Freeze有没有注意到这一点。我正在使用 cx_Freeze 创建 msi 安装程序。

Where can I download _winreg for python3 if I can at all. I have my 'windir' on E:\Windows. I do not know if cx_Freeze did not notice that. I am using cx_Freeze to create an msi installer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

太阳哥哥 2024-10-12 12:05:55

正如 _winreg 文档 中所述,它已重命名为 winreg。如果您要转换为 Python 编写的代码,则应运行 2to3 工具2.x。

As it says in the _winreg documentation, it has been renamed to winreg in Python 3.0. You should run the 2to3 tool if you're converting code that was written for Python 2.x.

几味少女 2024-10-12 12:05:55

我知道这是一个老问题,但这是在谷歌搜索 ModuleNotFoundError: No module named '_winreg' 时的第一个搜索结果,也许对某人有帮助。

当尝试使用虚拟环境文件夹时,我遇到了同样的错误,该文件夹是使用不同的(已删除的)python 二进制文件创建的。解决方案是重新创建虚拟环境:

  1. 删除虚拟环境文件夹
  2. 运行 python -m venv

I know this is an old question, but this was the first search result when Googling for ModuleNotFoundError: No module named '_winreg', and perhaps may be helpful for someone.

I got the same error when trying to use a virtual environment folder, which has been created using different (already deleted) python binaries. The solution was recreate the virtual environment:

  1. Delete the virtual environment folder
  2. Run python -m venv <name_of_virtual_environment>
猫九 2024-10-12 12:05:55

我找到了一个简单的解决方案,尽管我经过大量研究后发现它,但解决方案的实现非常简单和直接。希望它可以帮助很多遇到同样问题的人。

如果您的计算机上没有安装最新版本的 Python,则需要从 (https:// www.python.org/downloads/),然后单击“添加到路径”选项并完成安装程序。

请打开CMD并移动到python最新版本目录,然后运行pip install软件包名称(例如)pip install pygame,它将成功

1. C:\WINDOWS\system32>cd C:\Users\admin\AppData\Local\Programs\Python\Python37-32

    2. C:\Users\admin\AppData\Local\Programs\Python\Python37-32>pip install Pygame 

它现在将安装软件包,没有任何问题。

正在下载
成功安装Pygame-1.9.4

C:\Users\admin\AppData\Local\Programs\Python\Python37-32>

如果尝试上述解决方案后您在 Pycharm 中仍然遇到问题,请也尝试以下步骤。

  1. 从设置菜单创建新的虚拟环境,并选择最新版本的 python 框架作为项目解释器,并提供新的文件夹路径。

  2. 选择要导入的pip包。重新编译代码,错误就会消失。

希望这有帮助。

I have found an easy solution for this, Even though i found it after a lot of Rnd, the solution implementation is so simple and straight forward. Hope it can help many people with the same problem.

If you dont have the latest version of Python installed on your machine, You need to download it from (https://www.python.org/downloads/) and then click on Add to path option and just finish the installer.

Please open CMD and move to the python latest version directory, then run the pip install package name (e.g) pip install pygame and it will be successful

1. C:\WINDOWS\system32>cd C:\Users\admin\AppData\Local\Programs\Python\Python37-32

    2. C:\Users\admin\AppData\Local\Programs\Python\Python37-32>pip install Pygame 

It will install the packages now without any issues.

Downloading
Successfully installed Pygame-1.9.4

C:\Users\admin\AppData\Local\Programs\Python\Python37-32>

If you are still facing issues in Pycharm after trying the above solution, please try the following steps too.

  1. Create new virtual Environment from settings menu and select the latest version of python framework as Project Interpreter and give a new folder path.

  2. select the pip package you want to import. Recompile the code and the error will clear.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文