【发布时间】:2018-05-08 07:14:17
【问题描述】:
我正在尝试使用 Wine 将 Python 脚本从我的 Linux 平台交叉编译为 Windows 可执行文件。除了我的程序的所有 Python 依赖项之外,我还在 Wine 环境中成功安装了适用于 Windows 64 位和 pyinstaller 的 Python 3.6.0。
运行wine py my_file.py 可以正确运行我的程序而不会引发任何错误。但是,当尝试运行使用 pyinstaller 构建的交叉编译的 .exe 时,会出现以下错误:
File "site-packages\pandas\__init__.py", line 35, in <module>
ImportError: C extension: No module named 'pandas._libs.tslibs.timedeltas' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
[275] Failed to execute script parser
我使用git clone https://github.com/pandas-dev/pandas.git 将Pandas 源代码下载到我的Wine drive_c 文件夹中,然后运行wine py setup.py build_ext --inplace --force 并收到以下错误:
fixme:ntdll:NtQueryInformationJobObject stub: 0x54 9 0x33eff0 112 0x33efec
install requires: 'python-dateutil < 2','numpy'. use pip or easy_install.
$ pip install 'python-dateutil < 2' 'numpy'
fixme:msvcrt:__clean_type_info_names_internal (0x1e1f9bc8) stub
fixme:ver:GetCurrentPackageId (0x33ef18 (nil)): stub
但是,运行 wine py -m pip freeze 表明我已经安装了这些模块的正确版本:
altgraph==0.14
beautifulsoup4==4.6.0
bs4==0.0.1
future==0.16.0
html5lib==0.999999999
lxml==4.1.1
macholib==1.8
numpy==1.13.3
pandas==0.21.0
pefile==2017.11.5
PyInstaller==3.3
pypiwin32==220
python-dateutil==1.5
pytz==2017.3
six==1.11.0
webencodings==0.5.1
我还可以从我的 Python 解释器中成功导入这些模块:
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import dateutil
>>> print(dateutil.__version__)
1.5
>>> import numpy
>>> print(numpy.__version__)
1.13.3
>>>
是什么阻止我在 Wine 环境中构建 Pandas?
【问题讨论】:
-
我一直是experimenting a lot with Python on Wine - 我很惊讶地看到您首先设法在 Wine 上安装和运行 CPython 3.6。 a bug in Wine which prevented running CPython 3.6AFAIK 已经有一段时间了。一个补丁最近才添加到 Wine-staging 中。您看到的错误对我来说是新的,但我仍然想建议尝试 3.5.x。 CPython 3.6 在 Windows API 使用方面进行了现代化改造,这也可能导致您的问题。你能查一下吗?
-
@s-m-e 在摆弄了一段时间没有成功之后,我暂时搁置了让我的脚本交叉编译的努力。 CPython 3.6 问题令人头疼。一旦我再次开始工作,我会告诉你是否可以在 3.5 上工作。
标签: python python-3.x pandas pyinstaller wine