我在
Windows 10上,我安装了anaconda但是我想在一个新的,干净的最小环境中使用python 3.5独立创建一个可执行文件.所以我做了一些测试:
TEST1:
我在文件夹testenv中创建了一个python脚本test1.py,只有:
print('Hello World')
然后我创建了环境,安装了pyinstaller并创建了可执行文件
D:\testenv> python -m venv venv_test
...
D:\testenv\venv_test\Scripts>activate.bat
...
(venv_test) D:\testenv>pip install pyinstaller
(venv_test) D:\testenv>pyinstaller --clean -F test1.py
它创建了大约6 Mb的test1.exe
测试2:我修改了test1.py如下:
import pandas as pd
print('Hello World')
我在环境中安装了pandas并创建了新的可执行文件:
(venv_test) D:\testenv>pip install pandas
(venv_test) D:\testenv>pyinstaller --clean -F test1.py
Ant它创建我的test1.exe,现在是230 Mb !!!
如果我运行命令
(venv_test) D:\testenv>python -V
Python 3.5.2 :: Anaconda custom (64-bit)