Pertama, saya seorang pemula jadi mohon bersabar.
Saya mencoba menerapkan aplikasi web python menggunakan Nginx/Gunicorn/Python/Matlab, saya menggunakan beberapa perpustakaan Matlab yang dikemas (melalui LibraryCompiler) untuk dipanggil dari python menggunakan import Matlab package
dalam skrip Python.
Untuk mengimpor perpustakaan yang dikemas Matlab, saya perlu menginstal runtime Matlab. Setelah menginstal runtime Matlab, saya menyarankan saya untuk mengatur jalur runtime Matlab ke LD_LIBRARY_PATH.
Saya menambahkan baris berikut menggunakan nano ~/.bashrc
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/MATLAB/MATLAB_Runtime/v99/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v99/bin/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v99/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Runtime/v99/extern/bin/glnxa64
Tanpa mengatur LD_LIBRARY_PATH di bash, mencoba mengimpor perpustakaan matlab yang dikemas, itu akan menimbulkan kesalahan RuntimeError: On Linux, you must set the environment variable "LD_LIBRARY_PATH" to a non-empty string. For more details, see the package documentation.
setelah menyetel LD_LIBRARY_PATH, ini berfungsi dengan sempurna secara lokal tetapi ketika saya menggunakan sudo gunicorn3 app:server
gagal memuat skrip python saya dan menampilkan pesan yang sama seolah-olah saya tidak menyetel LD_LIBRARY_PATH
inilah yang tampak bagi saya ketika mencoba menjalankan aplikasi web saya.
[2020-12-17 20:48:12 +0000] [29324] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/usr/lib/python3/dist-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/usr/lib/python3/dist-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/lib/python3/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/lib/python3/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/lib/python3/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/lib/python3/dist-packages/gunicorn/util.py", line 377, in import_app
__import__(module)
File "/home/hossamedwee/flaskapplication/app.py", line 30, in <module>
import cyclo
File "/usr/local/lib/python3.6/dist-packages/cyclo/__init__.py", line 283, in <module>
_pir.get_paths_from_os()
File "/usr/local/lib/python3.6/dist-packages/cyclo/__init__.py", line 175, in get_paths_from_os
'For more details, see the package documentation.'))
RuntimeError: On Linux, you must set the environment variable "LD_LIBRARY_PATH" to a non-empty string. For more details, see the package documentation.
Mohon ada saran?