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

如何使用 pyinstaller 創建最小大小的可執行文件

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

問題描述

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

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 文件夾中創建了一個 python 腳本 test1.py,只有:

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

print('Hello World')

然后我創建了環境,安裝了pyinstaller并創建了可執行文件

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

它會創建大約 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')  

我在環境中安裝了 pandas 并創建了新的可執行文件:

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 它創建了我的 test1.exe,它現在是 230 Mb!?。?em class="showen">

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)

當我運行 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'

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

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

我知道有一些相關的問題:減小pyinstaller exe的大小, 使用 pyinstaller 和 numpy 的可執行文件的大小但我無法解決問題,我擔心我在 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.

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

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

推薦答案

問題是你不應該使用虛擬環境,尤其是 anaconda.請下載默認的 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.

雖然您創建了一個虛擬環境,但您確定您的規范文件沒有鏈接到舊的 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.

這篇關于如何使用 pyinstaller 創建最小大小的可執行文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 對象)
主站蜘蛛池模板: 逼逼视频| 蜜臀网 | 午夜影晥 | 别c我啊嗯国产av一毛片 | av电影一区二区 | 夜夜精品浪潮av一区二区三区 | 日韩高清黄色 | 亚洲精品麻豆 | 99精品国自产在线观看 | 男人的天堂中文字幕 | 欧美日韩一区二区视频在线观看 | av大全在线 | 日韩在线国产精品 | 欧美一区2区三区4区公司二百 | 亚洲精品一区在线观看 | 国产精品欧美一区二区 | 在线视频第一页 | 日韩aⅴ视频 | 日韩久久久久久 | 国产亚洲一区二区精品 | 国产精品色一区二区三区 | 日本成人在线观看网站 | 欧美成人精品一区 | 久久久2o19精品 | 国产日韩欧美在线观看 | 欧美日韩国产高清视频 | 欧美成人免费 | 日韩国产在线观看 | www.com久久久 | 午夜影院污 | 国产高清一区二区 | 日韩精品一区二区三区中文字幕 | 亚洲国产精品一区二区三区 | 小川阿佐美pgd-606在线 | 成人中文字幕在线 | 国产精品高清在线 | 瑟瑟激情 | www..com18午夜观看 | 色婷婷综合久久久中文字幕 | 日本精品999 | 蜜桃免费一区二区三区 |