Import issue for setproctitle on Mac OS,

℡╲_俬逩灬. 提交于 2020-12-06 02:58:09

问题


In python, If I try to import setproctitle I get the following import error:

 ImportError: dlopen(/Users/xxx/.local/share/virtualenvs/airflow_gg-F_Vv1Po_/lib/python3.7/site-packages/setproctitle.cpython-37m-darwin.so, 2): Symbol not found: _Py_GetArgcArgv
      Referenced from: /Users/xxx/.local/share/virtualenvs/airflow_gg-F_Vv1Po_/lib/python3.7/site-packages/setproctitle.cpython-37m-darwin.so
      Expected in: flat namespace
 in /Users/xxx/.local/share/virtualenvs/airflow_gg-F_Vv1Po_/lib/python3.7/site-packages/setproctitle.cpython-37m-darwin.so

What I have tried so far:

  • Try to reinstall it (with different flags such as --upgrade and --no-cache)
  • Try to use both venv and Pipenv

Info on my system: System version: macOS 10.15.2 (19C57), Kernel version: Darwin 19.2.0

I did not manage to find any information online for this specific import error. Any ideas?

--- Edit

I installed python 3.8 from the official website and, indeed, it works (with that interpreter as base for venv). I previously had python 3.7 installed with brew (brew install python3). I do not know why it did not work.


回答1:


Works fine for Python 3.8 installed directly from Python page.

> python3.8 -m pip install virtualenv
> python3.8 -m virtualenv -p \
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 proctest
> source proctest/bin/activate
> python3.8 -m pip install setproctitle
> python3.8
...
...
>>> import setproctitle
>>>


来源:https://stackoverflow.com/questions/60147788/import-issue-for-setproctitle-on-mac-os

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!