sys.path 在 Python shell 上的问题
Problems with sys.path on Python shell
我正在尝试 运行 导入 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
有人可以帮我吗?
NameError: 名称 'sys' 未定义
要解决此问题,您需要 "import sys" 在使用它调用任何函数之前。
我发现我只能写import sys
:)
我正在尝试 运行 导入 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
有人可以帮我吗?
NameError: 名称 'sys' 未定义
要解决此问题,您需要 "import sys" 在使用它调用任何函数之前。
我发现我只能写import sys
:)