mac从python3.9升级至python3.10后之前有的包又得重新安装

问题现象:
原生操作系统python3.9的路径在:
/Library/Developer/CommandLineTools/usr/bin/python3.9

使用python官网的安装包升级后:https://www.python.org/ftp/python/3.10.10/python-3.10.10-macos11.pkg

python3.10的路径在:
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3

此时再执行之前的python一些脚本就会发现报类似下面的错误:

ModuleNotFoundError: No module named /Library/Frameworks/Python.framework/Versions/3.10/bin/python3

解决办法:

/Library/Frameworks/Python.framework/Versions/3.10/bin/python3  -m pip install SomePackage

或者

python3.10 -m pip install SomePackage

或者

pip3.10 -m pip install SomePackage

你可能感兴趣的:(报错,macos,python,linux)