Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere Python 数据库支持

 

在 Unix 和 Mac OS X 上安装 sqlanydb

以下步骤介绍了如何在支持的 Unix 平台(包括 Mac OS X)中安装 sqlanydb 模块。

♦  准备计算机
  1. 安装 Python 2.4 或更高版本。

  2. 如果 ctypes 模块丢失,则安装 ctypes 模块。

♦  在 Unix 和 Mac OS X 上安装 sqlanydb 模块
  1. 确保设置了适用于 SQL Anywhere 的环境。

    根据您使用的 shell,输入相应的命令以从 SQL Anywhere 安装目录执行 SQL Anywhere 配置脚本:

    在此 shell 中…… ... 使用此命令
    sh、ksh 或 bash . bin/sa_config.sh
    csh 或 tcsh source bin/sa_config.csh
  2. 在 shell 提示符处,转到 SQL Anywhere 安装目录的 sdk/python 子目录。

  3. 输入以下命令安装 sqlanydb。

    python setup.py install
  4. 要测试 sqlanydb,请将示例数据库文件复制到 sdk/python 目录中,然后进行测试。

    cp samples-dir/demo.db .
    dbeng11 demo
    python scripts/test.py

    如果测试没有运行,请确保路径中包含 SQL Anywhere 安装目录的 bin32bin64 子目录。

现在即可使用 sqlanydb 模块。