ModuleNotFoundError:没有名为"pandas._libs.tslibs.timedeltas"的模块 [英] ModuleNotFoundError: No module named 'pandas._libs.tslibs.timedeltas'

查看:889
本文介绍了ModuleNotFoundError:没有名为"pandas._libs.tslibs.timedeltas"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Python的学习者.执行我的脚本时出现问题. 由于

I'm a learner of Python. There is a problem on executing my script. It shows failed to execute script while packing by Pyinstaller due to

ModuleNotFoundError:没有名为"pandas._libs.tslibs.timedeltas"的模块.

ModuleNotFoundError: No module named 'pandas._libs.tslibs.timedeltas'.

我该如何解决?

我正在使用在Windows 10上运行的Python 3.6,Pyinstaller 3.4.

I'm using Python 3.6, Pyinstaller 3.4, running on Windows 10.

推荐答案

导航到您的python文件夹内的pyinstaller文件夹-该文件夹已安装在该文件夹中.可能是与此类似的路径:

Navigate to your pyinstaller folder, within your Python folder - where it was installed. It might be a path similar to this:

C:\Users\yourName\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\PyInstaller\hooks

在此文件夹中,找到名为hook.pandas.py的文件,如果该文件不在文件夹中,则需要创建它.打开您的IDE或您一直在编写Python脚本的任何地方,然后创建一个新文件.这正是您的hook-pandas.py外观:

In this folder, find the file named hook.pandas.py if it is not in the folder, you will need to create it. Open your IDE or wherever you've been writing your Python scripts and create a new file. This is exactly what your hook-pandas.py should look like:

hiddenimports = ['pandas._libs.tslibs.timedeltas']

仅需一行.无需编辑或创建其他任何内容.保存,关闭并尝试再次使用Pyinstaller进行编译.这种方法的另一个好处是,在使用其他程序时,您无需编辑创建的每个规范文件.

That single line is all you need. No need to edit or create anything else. Save, close and attempt to compile using Pyinstaller again. The added benefit of this method is that you do not need to edit every spec file you create when working on other programs.

这篇关于ModuleNotFoundError:没有名为"pandas._libs.tslibs.timedeltas"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆