ninia / jep

Embed Python in Java
Other
1.31k stars 149 forks source link

install jep on mac M2 failed #502

Open sunriseLe opened 11 months ago

sunriseLe commented 11 months ago

Describe the problem

Environment (please complete the following information):

bsteffensmeier commented 11 months ago

The error indicates it is not able to find the python3.9 library. It is looking in /Applications/Xocde.app/Contents/Developer/Library/Framework/Python3.framework/Versions/3.9/lib but this directory does not exist. Is that the correct directory where your python is installed? I believe it is trying to find libpython3.9.dylib, so I recommend trying to find that file and figuring out why it is not in the directory where it is expecting it. On linux we occasionally see reports from people who can find libpython because they did not build python with the --enable-shared option so if you built python from source you may need to set that option.

sunriseLe commented 11 months ago
ndjensen commented 11 months ago

Your screenshot shows it's looking for the Python library under XCode but you have it installed elsewhere. I'm not sure why it's looking in the wrong place. The relevant part of the build is here in commands/python.py. If you want a quick and dirty fix, you could change that to use a hardcoded path of the directory like this

return ['-L{0}'.format('/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib')]

For a more permanent fix, I recommend searching online for how to set Xcode to use a specific Python that you've installed. Maybe that would make sysconfig.get_config_var('LIBDIR') return the right directory. If you figure it out, please come back and share what you've found as I doubt you'll be the only one to encounter this.

icemachined commented 8 months ago

You can use my distros as a Java dependency, https://github.com/icemachined/jep-distro. It contains arm64 binaries for all python versions with numpy integration available.

sunriseLe commented 8 months ago

你好,我是李晓芳,我已收到你的邮件,我会定时查看的。欢迎经常联系