【问题标题】:mysqlsh in Python mode, cannot import modulesPython模式下的mysqlsh,无法导入模块
【发布时间】:2018-05-24 19:02:42
【问题描述】:

Mysqlsh 新手我正在尝试导入模块 pandas,但我得到了:

 MySQL  Py > import pandas as pd
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named pandas

Mysqlsh ver. 8.0.11
Python ver. 2.7.15
Updated OSX

我可以在 Python 中导入 pandas,并且必须承认,我对 Python 和 MySQL Shell 之间的依赖关系一无所知

【问题讨论】:

    标签: python pandas import


    【解决方案1】:

    您的模块必须位于sys.path 列出的路径之一中。

     MySQL  Py > import sys
     MySQL  Py > sys.path
    

    全局安装pandas,或在mysqlsh 中将pandas 安装路径附加到sys.path

    【讨论】:

    • 我添加了 syspath 的路径,mysqlsh 现在可以找到 pandas。但是,我现在收到此错误: Traceback (most recent call last): File "", line 1, in File "C:\ProgramData\Anaconda2\lib\site-packages\pandas_init_ .py",第 19 行,在 "Missing required dependencies {0}".format(missing_dependencies)) ImportError: Missing required dependencies ['numpy'] 从 Anaconda Python 导入工作正常。可以导入 pandas 和 numpy。
    猜你喜欢
    • 1970-01-01
    • 2013-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-08
    • 2017-11-02
    相关资源
    最近更新 更多