久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

帶有 Pandas 的 PyInstaller 創建超過 500 MB 的 exe

PyInstaller with Pandas creates over 500 MB exe(帶有 Pandas 的 PyInstaller 創建超過 500 MB 的 exe)
本文介紹了帶有 Pandas 的 PyInstaller 創建超過 500 MB 的 exe的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我嘗試使用 PyInstaller 3.2.1 創建一個 exe 文件,出于測試目的,我嘗試為以下代碼制作一個 exe:

I try to create an exe file using PyInstaller 3.2.1, for test purpose I tried to make an exe for following code:

import pandas as pd
print('hello world')

經過相當長的時間(15 分鐘以上),我完成了 620 MB 的 dist 文件夾并構建了 - 150 MB.我使用 Python 3.5.2 |Anaconda custom(64 位)在 Windows 上工作.可能值得注意的是,在 dist 文件夾中,mkl 文件負責將近 300 MB.我使用pyinstaller.exe foo.py"運行 pyinstaller.我嘗試使用 --exclude-module 排除一些依賴項,但最終還是得到了巨大的文件.我使用 onefile 還是 onedir 沒有任何區別.

After considerable amount of time (15mins +) I finished with dist folder as big as 620 MB and build - 150 MB. I work on Windows using Python 3.5.2 |Anaconda custom (64-bit). Might be worth noting that in dist folder mkl files are responsible for almost 300 MB. I run pyinstaller using 'pyinstaller.exe foo.py'. I tried using --exclude-module to exclude some dependencies, still ended up with huge files. Whether I use onefile or onedir doesn't make any difference.

我知道 exe 必須包含一些重要文件,但大小接近 1 GB 是否正常?如有必要,我可以提供警告日志或任何有助于解決問題的內容.

I am aware that exe must contain some important files but is it normal to be as big as almost 1 GB? I can provide warning log if necessary or anything that could be helpful to solve the matter.

附:同時,我的同事從相同的示例腳本創建了一個 exe,最終不到 100 MB,不同之處在于他沒有使用 anaconda.會是這樣嗎?

P.S. In parallel my coworker created an exe from same sample script and ended up with less than 100 MB, difference is he is not using anaconda. Could that be the matter?

任何幫助將不勝感激.

推薦答案

PyInstaller 從 conda 包創建大可執行文件,從 pip 包創建小可執行文件.從這個簡單的python代碼:

PyInstaller create the big executable from the conda packages and the small executable from the pip packages. From this simple python code:

from pandas import DataFrame as df
print('h')

我通過 conda 包獲得了 203MB 的可執行文件,通過 pip 包獲得了 30MB 的可執行文件.但是 conda 是純 virtualenv 的一個很好的替代品.我可以使用 conda 和 Jupyter 進行開發,創建一些 mycode.py(我可以將 jupyter notebook 作為 py 文件下載到 myfolder 中).但我的最終解決方案是下一個:如果沒有,請安裝 Miniconda 并從 Windows 開始菜單打開 Anaconda Prompt;

I obtain the 203MB executable by the conda packages and the 30MB executable by the pip packages. But conda is the nice replacement of the pure virtualenv. I can develop with conda and Jupyter, create some mycode.py (I can download jupyter notebook as py-file in myfolder). But my final solution is next: If you do not have it, install Miniconda and from the Windows Start Menu open Anaconda Prompt;

    cd myfolder
    conda create -n exe python=3
    activate exe
    pip install pandas pyinstaller pypiwin32
    echo hiddenimports = ['pandas._libs.tslibs.timedeltas'] > %CONDA_PREFIX%Libsite-packagesPyInstallerhookshook-pandas.py
    pyinstaller -F mycode.py

在我創建新環境exe"的地方,pypiwin32 需要 pyinstaller 但不會自動安裝,hook-pandas.py 需要用 pandas 編譯.此外,導入子模塊并不能幫助我優化可執行文件的大小.所以我不需要這個東西:

Where I create new environment 'exe', pypiwin32 need for pyinstaller but is not installed automaticaly, hook-pandas.py need for compile with pandas. Also, import submodules do not help me optimize the size of the executable file. So I do not need this thing:

from pandas import DataFrame as df

但我可以使用通常的代碼:

but I can just use the usual code:

import pandas as pd

此外,在路徑中使用國家字母可能會出現一些錯誤,因此開發工具的英文用戶帳戶很好.

Also, some errors are possible along using the national letters in paths, so it is nice the english user account for development tools.

這篇關于帶有 Pandas 的 PyInstaller 創建超過 500 MB 的 exe的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 国产日韩精品在线 | 亚洲一二三区免费 | 色婷婷综合久久久中文字幕 | 妖精视频一区二区三区 | 一区二区电影 | 日本不卡一区二区三区在线观看 | 欧美男人亚洲天堂 | 人人做人人澡人人爽欧美 | 欧美国产精品一区二区三区 | 久久精品一级 | 国产在线精品一区二区三区 | 在线免费看91 | 国产成人精品免高潮在线观看 | 久久丝袜 | 国产精品成人一区二区三区 | 女同久久另类99精品国产 | 成人在线小视频 | 国产精品自拍视频网站 | 操操操av | 国产在线中文字幕 | 欧美日韩一区二区三区在线观看 | 亚洲成人蜜桃 | 亚洲精品视频一区二区三区 | 成人在线黄色 | 精品9999| 亚洲一区二区三区四区五区午夜 | 国产精品一区久久久 | 超碰97人人人人人蜜桃 | 成人免费视频网站在线观看 | 国产精品久久片 | 一区二区三区四区在线 | 久久综合一区二区三区 | 亚洲国产成人精品女人久久久 | 高清久久 | 宅女噜噜66国产精品观看免费 | 国产高清免费 | 综合欧美亚洲 | 亚洲国产高清免费 | 中文字幕在线欧美 | 美女人人操| 91av在线看 |