【问题标题】:Problems with sys.path on Python shellPython shell 上 sys.path 的问题
【发布时间】:2016-01-04 18:05:04
【问题描述】:

我正在尝试运行导入 Numpy 的 Python 代码。但是,每次我尝试这样做时,它都会显示

Error importing numpy: you should not try to import numpy from its source directory;
please exit the numpy source tree, and relaunch your python interpreter from there.

然后我删除了 Numpy 目录

sys.path.remove(\...)

并重新启动 Python shell。现在它仍然显示相同的错误消息,当我尝试使用 sys.path 命令时,它会打印

NameError: name 'sys' is not defined

谁能帮帮我?

【问题讨论】:

    标签: python numpy sys.path


    【解决方案1】:

    NameError: 名称 'sys' 未定义

    要解决这个问题,您需要在使用它调用任何函数之前“导入 sys”。

    【讨论】:

      【解决方案2】:

      我发现我只能写import sys :)

      【讨论】:

        猜你喜欢
        • 2021-04-10
        • 2013-11-26
        • 2014-06-06
        • 2011-04-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多