- Система: MacOS Sequoia 15.1.1, Apple M4
- Python3: 3.13.0 (загружено с сайта python.org)
- Python3-Intel64: 3.13.0 (загружено с сайта python.org)
- QGIS-LTR: 3.34.12-Prizren (загружено с qgis.org)
- Python установлен вместе с QGIS: 3.9.5
Ранее мне удалось запустить PyQGIS с помощью Jupyter Notebook в Windows 10, используя эту ссылку: https://gis.stackexchange.com/questions ... r-notebook (ответ: TSJ)
Теперь я использую MacOS Sequoia 15.1.1 с чипом M4, и мне не удалось повторить шаги, как в Windows 10. Может ли кто-нибудь мне помочь? может быть, есть другие альтернативы использованию PyQGIS в Jupyter Notebook?
Это то, что я сделал в MacOS:
a. Создана виртуальная среда Python и установлена Jupyter Notebook
cd /Users/myname/Documents
Python3-intel64 -m venv jupyternotebook
source jupyternotebook/bin/activate
pip install notebook
pip install pyqt5
jupyter notebook
б. В веб-браузере Jupyter Notebook я выполнил следующие команды:
import sys
sys.path.append("/Applications/QGIS-LTR.app/Contents/Resources/python")
print(sys.path)
Вывод:
['/Library/Frameworks/Python.framework/Versions/3.13/lib/python313. zip', '/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13', '/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/lib-dynload', '', '/Users/ganesh/Documents/Temporary/Python Project/jupyternotebook/lib/python3.13/site -пакеты', '/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages', '/Applications/QGIS-LTR.app/Contents/Resources/python']
import platform
platform.architecture()
Вывод:
('64bit', 'Mach-O')
from qgis.core import *
Вывод:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from qgis.core import *
File /Applications/QGIS-LTR.app/Contents/Resources/python/qgis/core/__init__.py:25
22 __copyright__ = '(C) 2014, Nathan Woodrow'
24 from qgis.PyQt.QtCore import NULL
---> 25 from qgis._core import *
27 from .additions.edit import edit, QgsEditError
28 from .additions.fromfunction import fromFunction
ImportError: dlopen(/Applications/QGIS-LTR.app/Contents/Resources/python/qgis/_core.so, 0x0002): tried: '/Applications/QGIS-LTR.app/Contents/Resources/python/qgis/_core.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')),
'/System/Volumes/Preboot/Cryptexes/OS/Applications/QGIS-LTR.app/Contents/Resources/python/qgis/_core.so' (no such file),
'/Applications/QGIS-LTR.app/Contents/Resources/python/qgis/_core.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))
Подробнее здесь: https://stackoverflow.com/questions/792 ... ile-but-is