在两个Python环境中使用pyinstaller [英] Using pyinstaller with two python environments
问题描述
我正在使用pyinstaller将一个.py文件打包到.exe中.我的WIN10 64位计算机上有两个Python3环境.一个来自 Anaconda ,另一个是来自独立安装的Python3-32bit .该.py文件是由 Anaconda Python环境产生的.安装pyinstaller之后,我像这样设置环境变量PATH:`
I'm using pyinstaller to pack one .py file into .exe. I have two Python3 environment on my WIN10 64-bit computer. One is from Anaconda and the other is Python3-32bit which is installed separately. This .py file is produced by Anaconda Python environment. After I installed pyinstaller, I set the environment variable PATH like this:`
PATH = PATH; C:\ Anaconda3 \ Scripts; C:\ Python35-32 \ Scripts;
PATH=PATH;C:\Anaconda3\Scripts;C:\Python35-32\Scripts;
但是,当我输入 pyinstaller file.py
时,会引发很多警告:
However, when I enter pyinstaller file.py
it throws me lots of warnings:
似乎 pyinstaller
在Python35-32的lib文件夹而不是Anaconda的lib文件夹中搜索依赖项.如何使其在Anaconda的lib文件夹下搜索依赖项?`
It seems that pyinstaller
searches dependencies in Python35-32's lib folder rather than Anaconda's. How can I make it searche dependencies under Anaconda's lib folder?
`
推荐答案
您是使用pip还是(ana)conda安装pyinstaller的?如果是这样,请使用以下命令检查pip是python3-32bit还是anaconda:
Did you install pyinstaller using pip or using (ana)conda? if so, check whether pip is the python3-32bit or the anaconda one with:
pip -V
这将告诉您是否在32位解释器上安装了pip以及pyinstaller,以及为什么要在该特定文件夹中查找它.
This will tell you if pip, and hence pyinstaller, was installed on the 32-bit interpreter, hence why it's looking in that particular folder.
解决方案是使用conda或在anaconda IDE中安装pyinstaller.可能需要从python3-32bit卸载pyinstaller
solution would be to install pyinstaller using conda or within the anaconda IDE. Probably would need to uninstall pyinstaller from python3-32bit
这篇关于在两个Python环境中使用pyinstaller的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!