Python Heroku上的生成错误
我正在把我的Python应用程序推到Heroku,它正在安装需求,最后它崩溃了。下面是日志的尾部:Python Heroku上的生成错误,python,heroku,Python,Heroku,我正在把我的Python应用程序推到Heroku,它正在安装需求,最后它崩溃了。下面是日志的尾部: .... SWIG/_m2crypto_wrap.c:4237: warning: 'saltlen' may be used uninitialized in this function gcc -pthread -shared build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -L/usr/lib -lssl -lcrypto -o build
....
SWIG/_m2crypto_wrap.c:4237: warning: 'saltlen' may be used uninitialized in this function
gcc -pthread -shared build/temp.linux-x86_64-2.7/SWIG/_m2crypto_wrap.o -L/usr/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.7/M2Crypto/__m2crypto.so
Creating /tmp/build_5a922389-3865-4fa2-9bc3-ecfa3cd84781/.heroku/venv/lib/python2.7/site-packages/M2Crypto.egg-link (link to .)
M2Crypto 0.22.dev is already the active version in easy-install.pth
Installed /tmp/build_5a922389-3865-4fa2-9bc3-ecfa3cd84781/.heroku/src/m2crypto
Successfully installed M2Crypto
Cleaning up...
Traceback (most recent call last):
File "/tmp/buildpack_5a922389-3865-4fa2-9bc3-ecfa3cd84781/vendor/virtualenv-1.7/virtualenv.py", line 16, in <module>
import tempfile
File "/usr/local/lib/python2.7/tempfile.py", line 32, in <module>
import io as _io
File "/usr/local/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: /tmp/build_5a922389-3865-4fa2-9bc3-ecfa3cd84781/.heroku/venv/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyLong_AsInt
! Error making virtualenv relocatable
! Push rejected, failed to compile Python app
M2Crypto在清理之前编译
以后编辑:
如果我在heroku盒上运行pip
命令,我会得到一个非常相似的错误:
Traceback (most recent call last):
File "/app/.heroku/venv/bin/pip", line 10, in <module>
load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
File "/app/.heroku/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 337, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/app/.heroku/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 2279, in load_entry_point
return ep.load()
File "/app/.heroku/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/app/.heroku/venv/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg/pip/__init__.py", line 5, in <module>
import subprocess
File "/usr/local/lib/python2.7/subprocess.py", line 427, in <module>
import select
ImportError: /app/.heroku/venv/lib/python2.7/lib-dynload/select.so: undefined symbol: _PyInt_AsInt
回溯(最近一次呼叫最后一次):
文件“/app/.heroku/venv/bin/pip”,第10行,在
加载入口点('pip==1.0.2','console\u scripts','pip')()
文件“/app/.heroku/venv/lib/python2.7/site packages/distribute-0.6.24-py2.7.egg/pkg\u resources.py”,第337行,加载入口点
返回获取分布(dist)。加载入口点(组、名称)
文件“/app/.heroku/venv/lib/python2.7/site packages/distribute-0.6.24-py2.7.egg/pkg\u resources.py”,第2279行,加载入口点
返回ep.load()
文件“/app/.heroku/venv/lib/python2.7/site packages/distribute-0.6.24-py2.7.egg/pkg_resources.py”,第1989行,已加载
条目=\uuuuu导入(self.module\u名称,globals(),globals(),[''\uuuuuu名称\uuuuu'])
文件“/app/.heroku/venv/lib/python2.7/site packages/pip-1.0.2-py2.7.egg/pip/\uuuu init\uuuuuuuuu.py”,第5行
导入子流程
文件“/usr/local/lib/python2.7/subprocess.py”,第427行,在
导入选择
ImportError:/app/.heroku/venv/lib/python2.7/lib-dynload/select.so:未定义的符号:\u PyInt\u AsInt
事实证明,Heroku刚刚将其运行时更新为python-2.7.7
我必须指定runtime.txt并清除应用程序的缓存(两次)来修复它
$ cat python-2.7.7>runtime.txt
然后安装heroku repo插件并清除缓存。由于未知的原因,清洗机第一次不起作用,不得不使用两次
$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a appname
更多关于heroku repo插件的信息
此问题在或中进行了讨论。下面是完整的生成日志:
$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a appname