我有一個使用cx_Oracle(在virtualenv中)的Python項目(運行在Ubuntu 12.04上)。當我運行這個項目時,我不會導入這個模塊。現在我想用主管來控制我的項目。當我開始從主管,開始崩潰項目和上升這個異常:導入cx_oracle的問題
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/home/vagrant/scrapy/local/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
File "/vagrant/scrapy_server/flask_server/api.py", line 8, in <module>
from resources.routes import routes
File "/vagrant/scrapy_server/flask_server/resources/routes.py", line 1, in <module>
from server.server import ServerStart, ServerStatus, ServerStop
File "/vagrant/scrapy_server/flask_server/resources/server/server.py", line 8, in <module>
from core.pool import ThreadPool
File "/home/vagrant/scrapy/src/scrapy/scrapy_server/apps/core/pool.py", line 7, in <module>
from resources.resources import Resources
File "/vagrant/scrapy_server/flask_server/resources/resources.py", line 10, in <module>
from repository.HotTypes import HotTypes
File "/vagrant/scrapy_server/flask_server/resources/repository/HotTypes.py", line 1, in <module>
from db_pg import DBPostgres
File "/vagrant/scrapy_server/flask_server/resources/repository/db_pg.py", line 1, in <module>
from resources.db_pg import DBPostgres as DBpostgresResources
File "/vagrant/scrapy_server/flask_server/resources/db_pg.py", line 1, in <module>
from core.dbcore import DBpostgresCore
File "/home/vagrant/scrapy/src/scrapy/scrapy_server/apps/core/dbcore.py", line 3, in <module>
import cx_Oracle
ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory
我跟着從this網站的說明,還this other網站。但我無法解決這個問題。
監督者的conf文件是:
[program:api_server]
command = /home/vagrant/scrapy/bin/gunicorn api:app
directory = /home/vagrant/scrapy/src/scrapy/scrapy_server/flask_server/
environment = PATH="/home/vagrant/scrapy/bin/python", ORACLE_HOME="/usr/lib/oracle/12.1/client64", LD_LIBRARY_PATH="/usr/lib/oracle/12.1/client64/lib"
user = vagrant
autostart=true
autorestart=true
stderr_logfile=/var/log/api.err.log
stdout_logfile=/var/log/api.out.log
redirect_stderr = True
缺少什麼我在這裏?如果您需要更多信息,請告訴我,我會更新此問題。
謝謝大家
您是否設置了所有必需的env變量(如$ ORACLE_HOME,...)? –
是的,正如我寫的,我設置了所需的所有環境變量,如教程中所述(鏈接位於上方)。如果我手動啓動它,項目運行完好 – Sam