无法从使用 pandas 的 Python 程序构建 .exe
Unable to build .exe from Python program which uses pandas
我正在使用 pyinstaller 构建一个独立的可执行文件。 Pyinstaller 成功生成可执行文件,但是当我 运行 .exe 时,出现以下错误:
ImportError: C extension: 'lib' not built. If you want to import
pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
在尝试解决该问题时,我在 C:\Python34\Lib\site-packages\pandas 中寻找 'setup.py' 文件,但没有找到。我还使用 pip 卸载了 pandas,然后从 www.lfd.uci.edu/~gohlke/pythonlibs/. I also googled the error, and found someone who seemed to have a similar problem here 的 .whl 文件中重新安装。在那种情况下,问题已由 运行ning 'python setup.py build_ext --inplace --force' 解决,但同样,我在 pandas 目录中找不到 setup.py。我还找到了 "just use Linux" 的建议,但这不是一个选项,因为这是为了工作。我还尝试使用 py2exe 和 cx_freeze 构建可执行文件,但这些都不起作用。
我在 Windows 7 下使用 Python 3.4,当我从 PyCharm 内部 运行 时程序 运行 正确。我如何获得一个可工作的独立 .exe?
编辑:
在使用 py2exe 构建可执行文件并 运行ning 之后,我得到的错误是:
ImportError: (DLL load failed: the specified module could not be
found.)
'C:\Users\aarjad\PycharmProjects\MyProgram\dist\scipi.special._ufuncs.pyd')
但是,'scipi.special._ufuncs.pyd' 就在该文件夹中,所以我不知道那里会发生什么。
使用 cx_freeze 构建可执行文件并 运行 后,我得到的错误是:
ImportError: Error importing scipi: you cannot import scipi while
being in the scipi source directory; please exit teh scipy source tree
first, then relaunch your python interpreter.
通过将 cython 的 statsmodels 包中的 lowess 函数移植到 python 解决了这个问题,从而消除了导入 statsmodels 包的需要,而这正是 pyinstaller 令人窒息的地方。
我正在使用 pyinstaller 构建一个独立的可执行文件。 Pyinstaller 成功生成可执行文件,但是当我 运行 .exe 时,出现以下错误:
ImportError: C extension: 'lib' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
在尝试解决该问题时,我在 C:\Python34\Lib\site-packages\pandas 中寻找 'setup.py' 文件,但没有找到。我还使用 pip 卸载了 pandas,然后从 www.lfd.uci.edu/~gohlke/pythonlibs/. I also googled the error, and found someone who seemed to have a similar problem here 的 .whl 文件中重新安装。在那种情况下,问题已由 运行ning 'python setup.py build_ext --inplace --force' 解决,但同样,我在 pandas 目录中找不到 setup.py。我还找到了 "just use Linux" 的建议,但这不是一个选项,因为这是为了工作。我还尝试使用 py2exe 和 cx_freeze 构建可执行文件,但这些都不起作用。
我在 Windows 7 下使用 Python 3.4,当我从 PyCharm 内部 运行 时程序 运行 正确。我如何获得一个可工作的独立 .exe?
编辑:
在使用 py2exe 构建可执行文件并 运行ning 之后,我得到的错误是:
ImportError: (DLL load failed: the specified module could not be found.) 'C:\Users\aarjad\PycharmProjects\MyProgram\dist\scipi.special._ufuncs.pyd')
但是,'scipi.special._ufuncs.pyd' 就在该文件夹中,所以我不知道那里会发生什么。
使用 cx_freeze 构建可执行文件并 运行 后,我得到的错误是:
ImportError: Error importing scipi: you cannot import scipi while being in the scipi source directory; please exit teh scipy source tree first, then relaunch your python interpreter.
通过将 cython 的 statsmodels 包中的 lowess 函数移植到 python 解决了这个问题,从而消除了导入 statsmodels 包的需要,而这正是 pyinstaller 令人窒息的地方。