我试图在便携版Django中执行此操作:
from django.db import load_backend
myBackend = load_backend('django.db.backends.oracle') # or 'mysql', 'sqlite3', 'oracle'
但是,这会导致错误:Error loading cx_Oracle module: No module named cx_Oracle
。我认为这只是意味着没有安装cx_oracle
。当我执行pip install cx_oracle
(与我需要的其他模块相同)时,会导致此错误:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\build\cx-Oracle\setup.py", line 132, in <module>
raise DistutilsSetupError("cannot locate an Oracle software " \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\build\cx-Oracle\setup.py", line 132, in <module>
raise DistutilsSetupError("cannot locate an Oracle software " \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
----------------------------------------
Command python setup.py egg_info failed with error code 1 in e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\build\cx-Oracle
Exception information:
Traceback (most recent call last):
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\lib\site-packages\pip-1.1-py2.7.egg\pip\basecommand.py", line 104, in main
status = self.run(options, args)
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\lib\site-packages\pip-1.1-py2.7.egg\pip\commands\install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\lib\site-packages\pip-1.1-py2.7.egg\pip\req.py", line 1009, in prepare_files
req_to_install.run_egg_info()
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\lib\site-packages\pip-1.1-py2.7.egg\pip\req.py", line 225, in run_egg_info
command_desc='python setup.py egg_info')
File "e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\lib\site-packages\pip-1.1-py2.7.egg\pip\__init__.py", line 256, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in e:\PortableDjango\development\tools\virtualenvs\test_djangoproj\build\cx-Oracle
我认为它正在寻找我已经存在并位于PATH变量中的Oracle客户端。我还看了什么,或者在便携版Django中获得Oracle支持的最佳方式是什么?
答案 0 :(得分:0)
您需要修改LD_LIBRARY_PATH
以指向Oracle客户端库(lib
目录)或Windows版 - 下载appropriate windows binary。