【问题标题】:Importing numpy/scipy through Powershell with Python(x,y)使用 Python(x,y) 通过 Powershell 导入 numpy/scipy
【发布时间】:2015-08-10 06:01:13
【问题描述】:

我最近将 Python(x,y) 下载到我的机器(Windows 7)上,其中包括所有科学计算库(numpy、scipy 等)。我可以在 IDLE 和 Spyder(Python(x,y) 提供的 IDE)上导入 numpy,但不能使用 Powershell 来实现。这里有错误消息:http://imgur.com/FBgptlC。我用 numpy 编写的代码可以通过 IDLE 和 Spyder 运行。

【问题讨论】:

  • 我不知道 Python(x,y) 或使用 Windows,但这似乎是 PATH 问题;您需要在 PowerShell PATH 上获取 Python(x,y)。它在 IDLE 和 Spyder 中工作的原因是因为它们已经配置为使用 Python(x,y)。
  • 这就是我的想法。我的 PATH 变量设置为 C:\Python27,我可以进行正常的 Python 编程。接下来我该怎么办?
  • 在 PowerShell 中检查 $env:PSModulePath。
  • 我得到:C:\Users(我的名字)\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
  • 您的计算机上可能有 2 个 Python 安装,而您的 PATH 变量中的一个不是 Python(x, y),而是位于 C:\Python27 的标准 Python 安装。您应该从PATH 中删除C:\Python27,而是添加Python(x, y) 安装的安装目录(或Python(x, y) 的python 可执行文件所在的任何位置)。

标签: python powershell numpy scipy pythonxy


【解决方案1】:

我打开和关闭我的电脑,它工作正常。去图吧。

【讨论】:

    猜你喜欢
    • 2018-01-11
    • 2013-03-09
    • 2016-11-06
    • 2011-04-05
    • 2016-01-24
    • 2012-09-06
    • 2017-12-05
    • 2015-02-06
    • 1970-01-01
    相关资源
    最近更新 更多