簡體   English   中英

無法在Wine環境中從setup.py構建Pandas

[英]Cannot build Pandas from setup.py in Wine environment

我正在嘗試使用Wine將Python腳本從Linux平台交叉編譯為Windows可執行文件。 除了在我的Wine環境中為我的程序提供的所有Python依賴關系之外,我還為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中的隱藏導入/ pyinstaller中缺少鈎子導致的。 通過在drive_c / Python * / Lib / site-packages / PyInstaller / hooks中添加掛鈎文件可以解決問題。 此github問題中進行了討論,並通過上面的鏈接解決了。

我在這里這里的其他Stack Overflow問題中都能找到答案。

解決此問題后,我開始收到與numpy相關的錯誤(我不完全清楚它是什么,我認為它涉及日期,並且是在導入numpy或熊貓的過程中,因為我使用的是測試.py本質上只有這個問題)通過使用pip卸載並重新安裝熊貓來解決(在我的情況下,在/ path / to / drive_c / Python27中使用“ wine python.exe ./Scripts/pip.exe卸載熊貓”)解決。 最后,我發現此站點有助於了解如何在葡萄酒環境中工作(例如,如何在葡萄酒中使用點子)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM