sql - 在 Jupyter 笔记本中导入 cx_Oracle 会出现 ModuleNotFoundError
解决方案
要在您自己的笔记本电脑上安装cx_Oracle最新版本 8.0.0,您需要已安装以下组件:
- 蟒蛇 3x
- Oracle Instant Client 11g 或更高版本。参考下载即时客户端版本到这个链接
https://www.oracle.com/database/technologies/instant-client/downloads.html
在 Windows 上下载和安装适用于 Python 的 cx_Oracle 包的步骤。就我而言,我更喜欢 GitHub 中提供的版本
https://github.com/oracle/python-cx_Oracle
1.点击下载 cx_Oracle 链接从 Github 下载包。它将一个 zip 文件下载到您的笔记本电脑中。
2.将 zip 文件解压缩到 Windows 上的文件夹中。例如,C:\cx_oracle。
3.现在打开命令提示符,将当前目录更改为 C:\cx_oracle 目录以安装 cx_Oracle 包。
4.然后运行以下命令。
python -m pip install cx_Oracle --upgrade pip
它将在 Windows 上安装适用于 Python 的 cx_Oracle 包,您将收到如下所示的消息。
Collecting pip
Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
100% |¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦| 1.3MB 2.5MB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-18.0
重要的是,如果您有多个版本的 Python,请使用与 Jupyter 笔记本关联的版本。
推荐阅读
- python - pd.Series.explode 和 ValueError:无法从重复的轴重新索引
- java - JDBC - 从物化视图中选择查询不起作用
- javascript - Postgres 连接池在一段时间后耗尽
- automation - 将鼠标悬停在 cypress 中的 svg 上并测试工具提示
- python - 视网膜图像中的血管分割
- google-sheets - Google表格在where子句中的选择字符串内查询如何使用带有日期的参考单元格作为过滤器
- python - 我是 python 新手,没有以前的编码经验。我的程序应该根据年龄显示票价。为什么它不起作用?
- javascript - 如何在 Sapper 上使用 worker_threads?
- matlab - matlab中的采样率
- javascript - 如何在图像上方带有文本段落的鼠标移除后使图像上的 CSS 过渡返回到初始状态