使用 cx_freeze 和 pandas 在 dateutil/zoneinfo 上出现错误 3

2024-03-02

当我尝试使用 cx_freeze 编译 hello.py 文件时,pandas 0.15.2 出现以下错误,但 0.15.1 没有错误。

有人知道如何纠正它吗?

我已使用 include_files 函数包含 dateutil/zoneinfo 文件,但问题仍然出现。

你好.py:

import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
print 'hello world'
df_dates = pd.date_range(start='01/01/2013', freq='H', periods=100)
df = pd.DataFrame(range(len(df_dates)), index=df_dates)
print df
print df.info()
df.plot()
plt.savefig('test.png')
plt.show(block=False)

设置.py:

includes = ['dateutil.zoneinfo', 'pandas']  # nommer les modules non trouves par cx_freeze
excludes = []
packages = ['os', 'matplotlib.backends.backend_qt4agg', 'dateutil', 'dateutil.zoneinfo', 'pandas']

# copier les fichiers non-Python et/ou repertoires et leur contenu:

def include_files():
        path_base = "C:\\Anaconda\\Lib\\site-packages\\dateutil\\zoneinfo\\"
        skip_count = len(path_base) 
        zip_includes = [(path_base, "dateutil/zoneinfo/")]
        for root, sub_folders, files in os.walk(path_base):
            for file_in_root in files:
                zip_includes.append(
                        ("{}".format(os.path.join(root, file_in_root)),
                         "{}".format(os.path.join("dateutil/zoneinfo", root[skip_count:], file_in_root))
                        ) 
                )      
        return zip_includes

includefiles = include_files()
zip_includes = include_files()

# niveau d'optimisation pour la compilation en bytecodes
optimize = 1
## if optimize = 2 :     read_frame.__doc__ += read_sql.__doc__
##                       TypeError: unsupported operand type(s) for +=: 'NoneType' and 'NoneType'

# si True, n'affiche que les warning et les erreurs pendant le traitement cx_freeze
silent = True

# construction du dictionnaire des options
options = {   #'path': path,
           'includes': includes,
           'excludes': excludes,
           'packages': packages,
           'include_files': includefiles,
           'zip_includes': zip_includes,
           #'bin_path_includes': binpathincludes,
           'create_shared_zip': True,  # <= ne pas generer de fichier zip
           'include_in_shared_zip': True,  # <= ne pas generer de fichier zip
           'compressed': True,  # <= ne pas generer de fichier zip
           'optimize': optimize,
           'silent': silent
           }


base = None

cible_1 = Executable('hello.py', targetName="hello.exe")
#base=base,
#compress=True,  # <= ne pas generer de fichier zip
#copyDependentFiles=True,
#appendScriptToExe=True,
#appendScriptToLibrary=True,  # <= ne pas generer de fichier zip
#icon=icone
#)

# On appelle la fonction setup
setup(
    name = "salut",
    author = 'XXX',
    version = "0.1",
    description = "Ce programme vous dit bonjour",
    options={"build_exe": options},
    executables = [cible_1],
)

错误是:

[Error 3] Le chemin dÆaccÞs spÚcifiÚ est introuvable: 'C:\\Users\\Utilisateur\\D
esktop\\compilation\\build\\exe.win-amd64-2.7\\library.zip\\dateutil\\zoneinfo/*
.*'
Traceback (most recent call last):
 File "C:\Anaconda\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27
, in <module>
   exec(code, m.__dict__)
 File "hello.py", line 2, in <module>
 File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 7, in <module>
   from . import hashtable, tslib, lib
 File "ExtensionLoader_pandas_tslib.py", line 22, in <module>
 File "ExtensionLoader_pandas_tslib.py", line 14, in __bootstrap__
 File "pandas\tslib.pyx", line 44, in init pandas.tslib (pandas\tslib.c:79879)
 File "C:\Anaconda\lib\site-packages\dateutil\zoneinfo\__init__.py", line 32, i
n <module>
   ZONEINFOFILE = getzoneinfofile()
 File "C:\Anaconda\lib\site-packages\dateutil\zoneinfo\__init__.py", line 24, i
n getzoneinfofile
   filenames = os.listdir(os.path.join(os.path.dirname(__file__)))
WindowsError: [Error 3] Le chemin dÆaccÞs spÚcifiÚ est introuvable: 'C:\\Users\\
Utilisateur\\Desktop\\compilation\\build\\exe.win-amd64-2.7\\library.zip\\dateut
il\\zoneinfo/*.*'

None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 cx_freeze 和 pandas 在 dateutil/zoneinfo 上出现错误 3 的相关文章

  • 在 Python 中同时插入行

    我正在尝试对我的代码进行矢量化 但遇到了障碍 我有 nxd x 值数组 x1 xn 其中每一行 x1 有很多点 x11 x1d nxd y 值数组 y1 y2 y3 其中每一行 y1 有很多点 y11 y1d x 值的 nx1 数组 x 1
  • 将文件标记为从 Python 中删除?

    在我的一个脚本中 我需要删除当时可能正在使用的文件 我知道我无法删除正在使用的文件 直到它不再使用为止 但我也知道我可以将该文件标记为由操作系统 Windows XP 删除 我将如何在 Python 中做到这一点 以及另一个不依赖于 pyw
  • 如何将 UPX 与 pyinstaller 一起使用?

    如何将 UPX 与 pyinstaller 一起使用 我正在关注文档 我已经下载了UPX 我的文件如下所示 import csv import selenium import pandas print Hello 然后我运行 pyinsta
  • 将 2D Panda 的 DataFrame 列表转换为 3D DataFrame

    我正在尝试创建一个将标签值保存到 2D DataFrame 的 Pandas DataFrame 这是我到目前为止所做的 我正在使用读取 csv 文件pd read csv并将它们附加到列表中 出于这个问题的目的 让我们考虑以下代码 imp
  • 使用 Python 将阿拉伯语或任何从右到左书写系统的字符串打印到 Linux 终端

    非常简单的例子是 city print city 我期望输出是 但实际上输出是相反的字符串 字母看起来有点不同 因为它们有开始 中间和结束形式 我无法将其粘贴到此处 因为复制粘贴会再次更正字符串的顺序 如何在 Linux 终端上正确打印阿拉
  • 如何将嵌套的Python字典转换为简单的命名空间?

    假设我有一个深度为 N 的嵌套字典 如何将每个内部嵌套字典转换为简单的命名空间 example input key0a test key0b key1a key2a keyNx key2b test key1b test example o
  • Django“模型”对象不可迭代

    我有一张表 其中显示了已注册的员工 我想根据他们的数据库生成一个简单的 HTML 页面 其中包括他们的姓名 id 职称等 为此 我将一个 id 传递给视图 以便它可以获取相应用户的详细信息并向我显示 一切正常 直到出现错误对象不可迭代 下面
  • 按字符串子字符串的列过滤 Pandas 数据框

    我正在尝试使用列中的字符串值是数据框外部字符串的子字符串的条件来过滤数据框 下面的例子 df a b c hello bye hello reference str hello there output a c 一种方法可能是使用正则表达式
  • t /= d 是什么意思? Python 和错误

    t current time b begInnIng value c change In value d duration def easeOutQuad swing function x t b c d alert jQuery easi
  • 在 python 中使用 subprocess.call 时如何将 stdout 重定向到文件?

    我正在从另一个 python 脚本 A 调用一个 python 脚本 B 使用 subprocess call 如何将 B 的标准输出重定向到指定的文件 我正在使用 python 2 6 1 传递一个文件作为stdout参数为subproc
  • 收到“/:未找到事件。”使用 PyCharm 远程调试器时

    当我使用 PyCharm 通过 ssh 进行远程调试时tcsh shell 服务器 很多时候它停止工作 并显示 未找到事件 更具体地说 我在 pycharm 调试控制台中遇到以下内容 ssh username hostserver 22 p
  • Python itertools groupby 中令人不安的奇怪行为/错误?

    我在用itertools groupby解析一个短的制表符分隔的文本文件 文本文件有几列 我想做的就是对具有特定值的所有条目进行分组x在特定的列中 下面的代码对名为的列执行此操作name2 寻找变量中的值x 我尝试使用以下方法来做到这一点c
  • 如何连接多个字符串? [复制]

    这个问题在这里已经有答案了 如何将 stringList 中的所有字符串合并为一个而不打印它 例如 s joinStrings very hot day returns string print s Veryhotday 感觉有点倒退 但是
  • 返回吃异常

    我至少发现了以下行为weird def errors try ErrorErrorError finally return 10 print errors prints 10 It should raise NameError name E
  • Python 中的颜色处理

    对于我的聚类 GUI 我目前对聚类使用随机颜色 因为我事先不知道最终会得到多少个聚类 在 Python 中 这看起来像 import random def randomColor return random random random ra
  • 对 Python 列表元素进行分组

    我有一个 python 列表 如下所示 my list 25 1 0 65 25 3 0 63 25 2 0 62 50 3 0 65 50 2 0 63 50 1 0 62 我想根据以下规则对它们进行排序 1 gt 0 65 0 62 l
  • 在 Python 中伪造一个对象是否是类的实例

    假设我有一堂课FakePerson它模仿基类的所有属性和功能RealPerson 不扩展它 在Python 3中 是否可以伪造isinstance 为了认识到FakePerson as a RealPerson只通过修改对象FakePers
  • Python Web 编程的不同方法的优缺点

    我想使用 Python 编写一些服务器端脚本 但我对这样做的方法有点迷失了 它从 DIY CGI 方法开始 似乎以一些相当强大的框架结束 这些框架基本上可以自己完成所有工作 中间有很多东西 比如web py http webpy org P
  • 如何继承并重写 django 模型类来创建 listOfStringsField?

    我想为 django 模型创建一个新类型的字段 它基本上是一个 ListOfStrings 因此 在您的模型代码中 您将具有以下内容 模型 py from django db import models class ListOfString
  • 使用 TkInter 绑定设置不可交互(点击)覆盖

    我已经浏览了其他几篇关于类似问题的帖子 所有这些似乎都指向this https stackoverflow com questions 29458775 tkinter see through window not affected by

随机推荐