Collecting cx-Oracle==5.3
Downloading http://mirrors.aliyun.com/pypi/packages/14/05/4d492fb049eeee24ff8b5fdf23c6240b81ef168d4039dfbf6629e022ba6b/cgz (129kB)
100% |████████████████████████████████| 133kB 2.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-5N2OBt/cx-Oracle/setup.py", line 174, 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 /tmp/pip-build-5N2OBt/cx-Oracle/
原因分析:
sudo env | grep ORACLE_HOME没有输出,说明root用户的oracle环境没有配置,故出现以上错误
解决办法:
su -
vi /root/.bashrc
追加以下内容:
#oracle 11g installclient env
export ORACLE_HOME=/opt/ora11g/instantclient_11_2
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG='simplified chinese_china'.UTF8
export PATH=$PATH:$ORACLE_HOME/bin
source /root/.bashrc
#声明下环境变量: export ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1