成功解决mac系统下python2环境执行celery报错: File “/Users/lijiandong/miniconda3/envs/py2/lib/python2.7/ctypes/init.py”, line 384, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, AbsoluteToNanoseconds): symbol not found
File “/Users/lijiandong/miniconda3/envs/py2/lib/python2.7/ctypes/init.py”, line 384, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, AbsoluteToNanoseconds): symbol not found
百度谷歌找了很久发现, 很多issue 就是没有可用的解决方法如下:
- 试了 改/lib/python2.7/ctypes/util.py 文件
- Github全是issue链接:https://github.com/conda/conda/issues/10361
- 加环境变量:
import os os.environ['OBJC_DISABLE_INITIALIZE_FORK_SAFETY'] = 'YES'
最终解决方案
- 卸载python2,使用anaconda重新安装
操作如下:
# pip uninstall celery
# conda remove -n py2 --all
# conda create -n py2 python=2.7
# pip install celery
# clelery -h
>Options:
-A APP, --app=APP app instance to use (e.g. module.attr_name)
-b BROKER, --broker=BROKER
url to broker. default is 'amqp://guest@localhost//'
--loader=LOADER name of custom loader class to use.
--config=CONFIG Name of the configuration module
--workdir=WORKING_DIRECTORY
---- -- - - ---- Commands- -------------- --- ------------
+ Main:
| celery worker
| celery events
| celery beat
| celery shell
| celery multi
| celery amqp
+ Remote Control:
| celery status
| celery inspect --help
| celery inspect active