gpt4 book ai didi

python - Heroku 上的构建错误

转载 作者:行者123 更新时间:2023-12-01 05:11:49 27 4
gpt4 key购买 nike

我正在将我的 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/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

这是我正在使用的requrements.txt:

Flask==0.10.1
SQLAlchemy==0.7.8
Flask-Login==0.2.3
Flask-WTF==0.6
Flask-Gravatar
Flask-OAuth==0.12
Flask-SQLAlchemy
Flask-Mail
python-dateutil
alembic
psycopg2
requests
itsdangerous
markdown
raven
blinker
flask-cache
flask-heroku
pygeoip
flask-babel
beautifulsoup4
python-memcached
-e git+https://github.com/Hypernode/M2Crypto#egg=M2Crypto-0.22.dev
birdy

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

最佳答案

事实证明 Heroku 刚刚将其运行时更新为 python-2.7.7我必须指定一个runtime.txt并清除应用程序的缓存(两次)来修复它。

$ cat python-2.7.7>runtime.txt

然后安装heroku repo插件并清除缓存。由于未知原因,purge_cace 第一次不起作用,不得不使用两次。

$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a appname

有关 heroku-repo 插件的更多信息 here .

此问题在 this stackoverflow thread 中讨论。或this heroku forum thread .

关于python - Heroku 上的构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24058168/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com