在安装好python 2.7 默认路径是c:\python27之后,设置环境变量

https://jingyan.baidu.com/article/8ebacdf02d3c2949f65cd5d0.html

once the installation is complete, add the following locations to the windows PATH variable: C:\Python27 and C:\Python27\Lib\site-packages

  1. 点击屏幕底部菜单栏中的“计算机”图标。

    Python 2.7.14 Oracle connect

  2. 在弹出的窗口中点击顶部的“计算机”标签,然后在出现的菜单中点击“系统属性”选项。

    Python 2.7.14 Oracle connect

  3. 在新的页面中,点击左侧导航栏中的“高级系统设置”。

    Python 2.7.14 Oracle connect

  4. 在弹出的页面中, 点击下部的“环境变量”按钮。弹出环境变量的管理页面。

    Python 2.7.14 Oracle connect

  5. 在环境变量的管理页面中,在下部列表框中找到Path变量, 单击选中, 然后点击下面的“编辑”按钮。

    Python 2.7.14 Oracle connect

  6. 弹出的页面有两个输入框, 在“变量值”输入框的末尾添加你要增加的路径,格式为 ;全路径,即分号加路径。注意这里分号必须是英文分号。比如我在安装Python2.7后添加的部分如图所示。

    Python 2.7.14 Oracle connect

  7. 7

    点击确定,设置完成

 

1.到oracle官网注册一个账号,然后下载Oracle Database Express Edition 11g Release 2 for Windows x32

http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

安装完成后,默认的username 有两个 sys, system,对应的密码就是在你安装过程中要你输入的那个密码,还有自动产生一个默认的database xe.

2安装和使用教程可以查看这位兄弟的博客

https://www.cnblogs.com/cjw1115/p/6209439.html

3.安装完成之后如果想要查看安装的oracle是否真是32bit,可以查看这位兄弟的文章

https://blog.csdn.net/mrluoe/article/details/7261713

使用sqlplus命令

32bit

SQL> $ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Thu Aug 2 14:05:40 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

64bit

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 15 16:19:43 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bitProduction
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options


如果是64位,用sqlplus 连上之后会显示具体的位数信息,32位则不会显示。

4.从https://pypi.org/project/cx_Oracle/5.1.3/#files下载

cx_Oracle-5.1.3-12c.win32-py2.7.exe (295.1 kB)  Copy SHA256 hashSHA256

安装完成后,解压缩,将instantclient-basic-nt-12.2.0.1.0\instantclient_12_2里面的所有dll文件copy到C:\Python27\Lib\site-packages

打开cmd window

cd \

C:\>cd Python27

C:\Python27>python
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

>>> import cx_Oracle

>>> con=cx_Oracle.connect('username/[email protected]/xe')

>>> print con.version
11.2.0.2.0
>>> con.close()

 

5在pycharm或者visual studio

#import sys
#print(sys.path)

查看path 'C:\\Python27\\venv\\lib'

将site-packages 放到C:\Python27\venv\Lib 里面

Python 2.7.14 Oracle connect

相关文章:

  • 2021-09-06
  • 2021-06-21
  • 2022-02-25
  • 2022-02-17
  • 2022-12-23
  • 2021-12-22
猜你喜欢
  • 2021-08-12
  • 2021-11-02
  • 2021-05-25
  • 2021-09-03
相关资源
相似解决方案