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

如何使用 pyinstaller 創(chuàng)建最小大小的可執(zhí)行文件

How can I create the minimum size executable with pyinstaller?(如何使用 pyinstaller 創(chuàng)建最小大小的可執(zhí)行文件?)
本文介紹了如何使用 pyinstaller 創(chuàng)建最小大小的可執(zhí)行文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在 Windows 10 上,我安裝了 anaconda,但我想使用 python 3.5 在一個新的、干凈的最小環(huán)境中獨立創(chuàng)建一個可執(zhí)行文件.所以我做了一些測試:

I am on Windows 10, I have anaconda installed but I want to create an executable independently in a new, clean minimal environment using python 3.5. So I did some tests:

測試1:我在 testenv 文件夾中創(chuàng)建了一個 python 腳本 test1.py,只有:

TEST1: I created a python script test1.py in the folder testenv with only:

print('Hello World')

然后我創(chuàng)建了環(huán)境,安裝了pyinstaller并創(chuàng)建了可執(zhí)行文件

Then I created the environment, installed pyinstaller and created the executable

D:	estenv> python -m venv venv_test
...
D:	estenvvenv_testScripts>activate.bat
...
(venv_test) D:	estenv>pip install pyinstaller
(venv_test) D:	estenv>pyinstaller --clean -F test1.py

它會創(chuàng)建大約 6 Mb 的 test1.exe

And it creates my test1.exe of about 6 Mb

測試2:我修改test1.py如下:

TEST 2: I modified test1.py as follows:

import pandas as pd
print('Hello World')  

我在環(huán)境中安裝了 pandas 并創(chuàng)建了新的可執(zhí)行文件:

I installed pandas in the environment and created the new executable:

(venv_test) D:	estenv>pip install pandas
(venv_test) D:	estenv>pyinstaller --clean -F test1.py

Ant 它創(chuàng)建了我的 test1.exe,它現(xiàn)在是 230 Mb!!!

Ant it creates my test1.exe which is now of 230 Mb!!!

如果我運行命令

(venv_test) D:	estenv>python -V
Python 3.5.2 :: Anaconda custom (64-bit)

當(dāng)我運行 pyinstaller 時,我收到一些我不理解的消息,例如:

when I am running pyinstaller I get some messages I do not understand, for example:

INFO: site: retargeting to fake-dir 'c:\users\username\appdata\local\continuum\anaconda3\lib\site-packages\PyInstaller\fake-modules'

我還收到有關(guān) matplotlib 和其他與我的代碼無關(guān)的模塊的消息,例如:

Also I am getting messages about matplotlib and other modules that have nothing to do with my code, for example:

INFO:   Matplotlib backend "pdf": added
INFO:   Matplotlib backend "pgf": added
INFO:   Matplotlib backend "ps": added
INFO:   Matplotlib backend "svg": added

我知道有一些相關(guān)的問題:減小pyinstaller exe的大小, 使用 pyinstaller 和 numpy 的可執(zhí)行文件的大小但我無法解決問題,我擔(dān)心我在 anaconda 方面做錯了什么.

I know there are some related questions: Reducing size of pyinstaller exe, size of executable using pyinstaller and numpy but I could not solve the problem and I am afraid I am doing something wrong with respect to anaconda.

所以我的問題是:我究竟做錯了什么?我可以減小可執(zhí)行文件的大小嗎?

So my questions are: what am I doing wrong? can I reduce the size of my executable?

推薦答案

問題是你不應(yīng)該使用虛擬環(huán)境,尤其是 anaconda.請下載默認(rèn)的 32 位 python 并僅使用必要的模塊.然后按照鏈接中提供的步驟進行操作,這肯定會解決它.

The problem is that you should not be using a virtual environment and especially not anaconda. Please download default python 32 bit and use only necessary modules. Then follow the steps provided in the links, this should definitely fix it.

雖然您創(chuàng)建了一個虛擬環(huán)境,但您確定您的規(guī)范文件沒有鏈接到舊的 Anaconda 條目嗎?

Although you created a virtual env, are you sure your spec file is not linking to old Anaconda entries?

如果這一切都失敗了,那么提交一個錯誤,因為這很奇怪.

If all this fails, then submit a bug as this is very strange.

這篇關(guān)于如何使用 pyinstaller 創(chuàng)建最小大小的可執(zhí)行文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現(xiàn)問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標(biāo)記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 国产日韩精品一区二区三区 | 亚洲精品2区 | 高清国产午夜精品久久久久久 | 欧美黑人国产人伦爽爽爽 | 日韩一二三 | 久久av网站 | 男人的天堂中文字幕 | 97精品超碰一区二区三区 | 国产精品免费观看视频 | 91久久精品一区二区二区 | 一级黄色绿像片 | 亚洲欧美在线一区 | 天天av综合| 久久人| 色欧美综合 | 色婷婷久久 | 亚洲一区二区三区在线观看免费 | 欧美一区二区免费在线 | 国产精品久久久乱弄 | 国产精品久久久久久久久久久久午夜片 | 99久久久国产精品 | 欧美日韩国产精品一区 | 日韩成人 | 高清一区二区三区 | 色男人的天堂 | 91精品国产高清一区二区三区 | 91av在线电影 | www免费视频 | 亚洲国产高清免费 | 男人阁久久| 99re66在线观看精品热 | 日日干夜夜草 | 九九看片 | 欧美一级免费观看 | 日韩在线精品视频 | 久久9热| 青青草综合网 | 国产一区二区三区精品久久久 | 国产精品久久久久久久久久免费看 | 久久久国产精品一区 | 综合精品 |