python环境为3.11.4
paddlepaddle
pip install paddlepaddle==2.5.1
python -m pip install --upgrade pip
check paddle
python -c "import paddle; print(paddle.version)"
发生错误
➜ ~ python -c "import paddle; print(paddle.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/__init__.py", line 65, in <module>
import paddle.distributed # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/__init__.py", line 17, in <module>
from .spawn import spawn # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/spawn.py", line 22, in <module>
from paddle.distributed.cloud_utils import (
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/cloud_utils.py", line 17, in <module>
from paddle.distributed.utils.launch_utils import (
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/utils/launch_utils.py", line 25, in <module>
from paddle.distributed.fleet.launch_utils import get_backend_by_compile_flag
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/fleet/__init__.py", line 19, in <module>
from .base.distributed_strategy import DistributedStrategy # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/fleet/base/distributed_strategy.py", line 23, in <module>
from paddle.distributed.fleet.utils.log_util import logger
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/fleet/utils/__init__.py", line 23, in <module>
from . import hybrid_parallel_util # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/fleet/utils/hybrid_parallel_util.py", line 17, in <module>
from paddle.distributed.parallel import (
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/parallel.py", line 29, in <module>
from paddle.distributed.collective import (
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/collective.py", line 25, in <module>
from .fleet.layers.mpu.mp_ops import _c_concat # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/fleet/layers/mpu/__init__.py", line 15, in <module>
from .mp_layers import VocabParallelEmbedding
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/distributed/fleet/layers/mpu/mp_layers.py", line 18, in <module>
from paddle.nn import functional as F
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/nn/__init__.py", line 21, in <module>
from .clip import ClipGradByGlobalNorm # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/demo/opt/anaconda3/lib/python3.11/site-packages/paddle/nn/clip.py", line 17, in <module>
from sqlite3 import NotSupportedError
File "/Users/demo/opt/anaconda3/lib/python3.11/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/Users/demo/opt/anaconda3/lib/python3.11/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/Users/demo/opt/anaconda3/lib/python3.11/lib-dynload/_sqlite3.cpython-311-darwin.so, 0x0002): Symbol not found: (_sqlite3_enable_load_extension)
Referenced from: '/Users/demo/opt/anaconda3/lib/python3.11/lib-dynload/_sqlite3.cpython-311-darwin.so'
Expected in: '/usr/lib/libsqlite3.dylib'
ImportError: dlopen(/Users/demo/opt/anaconda3/lib/python3.11/lib-dynload/_sqlite3.cpython-311-darwin.so, 0x0002): Symbol not found: (_sqlite3_enable_load_extension)
Referenced from: '/Users/demo/opt/anaconda3/lib/python3.11/lib-dynload/_sqlite3.cpython-311-darwin.so'
Expected in: '/usr/lib/libsqlite3.dylib'
修改方法
vim .bash_profile
export DYLD_LIBRARY_PATH=/usr/local/opt/sqlite/lib:/usr/lib:/usr/local/lib:/usr/local
source .bash_profile
➜ ~ python -c "import paddle; print(paddle.__version__)"
2.5.1