2013-02-17 163 views
4

我开发了一个需要Shapely python库的小应用程序。我通过.exe文件在Windows上安装它,以便它自动将必要的DLL文件(geos.dll,geos_c.dll)放入Python27 \ Lib \ site-packages \ shapely \ DLLs中。无法使用Flask和Shapely在heroku上运行应用程序

当我试图在我的盒子创建的virtualenv,我通过PIP安装匀称的,但它没有把那些DLL文件,所以我得到这个错误:

from shapely.geos import lgeos 
File "...\lib\site-packages\shapely\geos.py", line 71, in <module> 
_lgeos = CDLL("geos.dll") 
File "C:\Python27\Lib\ctypes\__init__.py", line 353, in __init__ 
self._handle = _dlopen(self._name, mode) 
WindowsError: [Error 126] The specified module could not be found 

所以我手动替换那些2个DLL文件virtualenv \ Lib \ site-packages \ shapely \ DLLs文件夹,它工作。

我现在想部署在Heroku上的应用程序,但它再次失败,因为以下错误:

from shapely.geos import lgeos 
_lgeos = load_dll('geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so']) 
file "/app/.heroku/python/lib/python2.7/site-packages/shapely/geos.py", line 44, in  load_dll 
from shapely.coords import required 
file "/app/.heroku/python/lib/python2.7/site-packages/shapely/geos.py", line 47, in <module> 
libname, fallbacks or [])) 
Error: Could not find library geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so'] 
Process exited with status 1 
State changed from starting to crashed 

所以,我认为,因为没有在那里的2个DLL文件的崩溃。我复制那些2个文件在一个单独的文件夹,并通过混帐

我在我的应用程序的根制成的.profile文件,对那些2个文件复制到Python环境

的.profile

#Copy Shapely DLL Files to Site packages 
cp -r $HOME/env_files/DLLs $HOME/.heroku/python/lib/python2.7/site-packages/shapely/ 

他们推但该应用程序仍然崩溃,并出现相同的错误。

任何人都可以帮我解决这个问题吗?

回答

0

Heroku使用* nix系统 - 它适用于* .so类型库而不是 * .dll。

因此删除任何ENV变量和dll。

我通过PIP安装

pip install shapely 

安装从github失败

相关问题