我必须在我的软件包中包含pandas库,以便在没有安装pandas库但具有所有正确依赖关系的集群服务器上运行我的软件。
我尝试在我的电脑上构建来自源代码(版本0.8.1)的pandas库:
python setup.py build_ext --inplace
如果我将构建的pandas文件夹移动到我的电脑中的其他文件夹中的任何位置,我可以在我的软件中导入它(例如./mySoftwareFolder/pandas)
但是当我在群集服务器上使用pandas libray移动我的软件时,它会引发错误:
File "testPandas.py", line 9, in <module>
import pandas
File "/home/TEST/pandas/__init__.py", line 15, in <module>
raise ImportError('C extensions not built: if you installed already '
ImportError: C extensions not built: if you installed already verify that you are not importing from the source directory
就好像它没有编译一样。
我的方式包括库有什么问题?
非常感谢!
更新: 我复制到集群服务器的目录包含:
-bash-4.2$ ll -a pandas
totale 11476
drwxr-xr-x. 14 francesco dottor 4096 1 set 13.37 .
drwxr-xr-x. 10 francesco dottor 8192 1 set 13.36 ..
-rwxr-xr-x. 1 francesco dottor 2648299 1 set 13.36 _algos.so
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 compat
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 core
-rw-r--r--. 1 francesco dottor 394 1 set 13.36 info.py
-rw-r--r--. 1 francesco dottor 557 1 set 13.36 info.pyc
-rw-r--r--. 1 francesco dottor 1269 1 set 13.36 __init__.py
-rw-r--r--. 1 francesco dottor 1643 1 set 13.37 __init__.pyc
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 io
-rwxr-xr-x. 1 francesco dottor 7437108 1 set 13.36 lib.so
-rwxr-xr-x. 1 francesco dottor 474199 1 set 13.36 _period.so
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 rpy
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 sandbox
-rw-r--r--. 1 francesco dottor 844 1 set 13.36 setup.py
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 sparse
-rwxr-xr-x. 1 francesco dottor 1065313 1 set 13.36 _sparse.so
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 src
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 stats
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tests
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tools
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tseries
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 util
-rw-r--r--. 1 francesco dottor 42 1 set 13.36 version.py
-rw-r--r--. 1 francesco dottor 204 1 set 13.36 version.pyc
答案 0 :(得分:0)
您在哪个平台上构建C扩展?在群集计算机上,验证扩展共享对象(Linux / OSX上的.so文件和Windows上的.pyd文件)是否位于您复制的文件夹中:
08:21 ~/code/pandas/pandas $ ll
total 12568
-rw-r--r-- 1 wesm staff 1269 Aug 25 04:49 __init__.py
-rw-r--r-- 1 wesm staff 1645 Aug 25 04:52 __init__.pyc
-rwxr-xr-x 1 wesm staff 799464 Aug 25 04:50 _algos.so
-rwxr-xr-x 1 wesm staff 65712 Aug 25 04:48 _engines.so
-rwxr-xr-x 1 wesm staff 197056 Sep 1 22:13 _period.so
-rwxr-xr-x 1 wesm staff 341032 Aug 25 04:53 _sparse.so
drwxr-xr-x 6 wesm staff 204 Aug 25 04:52 compat
drwxr-xr-x 44 wesm staff 1496 Sep 1 17:34 core
drwxr-xr-x 3 wesm staff 102 Aug 25 04:49 finance
-rw-r--r-- 1 wesm staff 394 Aug 25 04:49 info.py
-rw-r--r-- 1 wesm staff 535 Aug 25 04:52 info.pyc
drwxr-xr-x 15 wesm staff 510 Sep 1 23:14 io
-rwxr-xr-x 1 wesm staff 2490600 Sep 1 22:13 lib.so
drwxr-xr-x 9 wesm staff 306 Sep 1 17:34 rpy
drwxr-xr-x 6 wesm staff 204 May 20 19:13 sandbox
-rw-r--r-- 1 wesm staff 844 Feb 22 2012 setup.py
drwxr-xr-x 17 wesm staff 578 Aug 25 04:52 sparse
drwxr-xr-x 55 wesm staff 1870 Sep 1 22:57 src
drwxr-xr-x 23 wesm staff 782 Aug 25 04:52 stats
drwxr-xr-x 40 wesm staff 1360 Sep 1 17:34 tests
drwxr-xr-x 16 wesm staff 544 Aug 25 04:52 tools
drwxr-xr-x 28 wesm staff 952 Sep 1 17:34 tseries
drwxr-xr-x 18 wesm staff 612 Aug 25 04:52 util
-rw-r--r-- 1 wesm staff 54 Sep 1 22:57 version.py
-rw-r--r-- 1 wesm staff 204 Sep 1 22:58 version.pyc