运行 UWSGI 时在 SO 中找不到符号 _PyByteArray_Type
Posted
技术标签:
【中文标题】运行 UWSGI 时在 SO 中找不到符号 _PyByteArray_Type【英文标题】:Symbol not found _PyByteArray_Type in SO when running UWSGI 【发布时间】:2020-04-11 16:26:05 【问题描述】:当关注quickstart UWSGI guide并尝试启动服务器时,出现以下错误:
ImportError: dlopen(/Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so, 2): Symbol not found: _PyByteArray_Type
Referenced from: /Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
Expected in: flat namespace
我尝试过的一些事情:
重新安装 UWSGI -pip install --upgrade --force-reinstall --no-binary :all: --no-cache-dir uWSGI==2.0.17
重新安装 anaconda
线索:
应用程序将使用 werkzeug 开发服务器正常运行而不会出现错误。 在~/anaconda3/bin/python
解释器中运行 from struct import pack, unpack
不会导致错误
'~/anaconda3/bin/python3' 和 '/Users/xxxxxxxx/anaconda3/bin/uwsgi' 都包含符号 (nm /Users/xxxxxxxx/anaconda3/bin/uwsgi | grep _PyByteArray_Type
)
我该如何解决这个问题?如果这是一个新问题,我应该在哪里报告? Conda 编译 Python 的方式有问题吗? UWSGI?
系统:
操作系统:OSX 10.15.2 康达:4.7.12 UWSGI:2.0.18 架构:x86_64完整的堆栈跟踪:
*** Starting uWSGI 2.0.18 (64bit) on [Wed Dec 18 19:46:58 2019] ***
compiled with version: 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4) on 17 December 2019 08:16:44
os: Darwin-19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64
nodename: base2010-6.local
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /private/tmp/mvp
detected binary path: /Users/xxxxxxxx/anaconda3/bin/uwsgi
your processes number limit is 2784
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 3.7.1 (default, Dec 14 2018, 13:28:58) [Clang 4.0.1 (tags/RELEASE_401/final)]
Python main interpreter initialized at 0x7fcbd6c04a60
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 416560 bytes (406 KB) for 8 cores
*** Operational MODE: preforking+threaded ***
Traceback (most recent call last):
File "myflaskapp.py", line 1, in <module>
from flask import Flask
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/flask/__init__.py", line 14, in <module>
from jinja2 import escape
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/environment.py", line 15, in <module>
from jinja2 import nodes
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/nodes.py", line 19, in <module>
from jinja2.utils import Markup
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/utils.py", line 16, in <module>
from jinja2._compat import text_type, string_types, implements_iterator, \
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/site-packages/jinja2/_compat.py", line 31, in <module>
import pickle
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/pickle.py", line 33, in <module>
from struct import pack, unpack
File "/Users/xxxxxxxx/anaconda3/lib/python3.7/struct.py", line 13, in <module>
from _struct import *
ImportError: dlopen(/Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so, 2): Symbol not found: _PyByteArray_Type
Referenced from: /Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
Expected in: flat namespace
in /Users/xxxxxxxx/anaconda3/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 9746)
spawned uWSGI worker 1 (pid: 9747, cores: 2)
spawned uWSGI worker 2 (pid: 9748, cores: 2)
spawned uWSGI worker 3 (pid: 9749, cores: 2)
spawned uWSGI worker 4 (pid: 9750, cores: 2)
*** Stats server enabled on 127.0.0.1:9191 fd: 16 ***
【问题讨论】:
你好,你有解决这个问题的办法吗?除了完全卸载 anaconda,因为我的项目依赖于它 【参考方案1】:我遇到了同样的问题,完全用remove Anaconda python 解决了它,并通过自制软件安装了python(brew install python)。
【讨论】:
以上是关于运行 UWSGI 时在 SO 中找不到符号 _PyByteArray_Type的主要内容,如果未能解决你的问题,请参考以下文章
使用 pytest 运行测试时出现问题 - 在我自己的包中找不到模块
requireNativeComponent:运行android应用程序时在UIManager中找不到“RNSScreenStackHeaderConfig”
收到错误:尝试创建/迁移/运行时在路径中找不到“nmake”
运行 Espresso 测试时在 Android Studio 中找不到属性 android:forceQueryable
使用boost在eclipse中找不到libboost_system.so.1.43.0
exec:“powershell”:在 Terraform 中运行 local-exec 时在 $PATH 中找不到可执行文件