我刚开始学习用 Python 编写代码(也是第一次使用 Powershell),所以我认为我的问题非常基础。当我尝试在 PS 中运行任何 Python 脚本时,我会收到如下所示的错误。我在网上找到的主要建议是 (1) 确保我已将执行策略设置为不受限制,以及 (2) 编辑我的路径以包含 "c:\Python27;c:\Python27\Scripts"
这两件事我都做过。我还应该尝试什么?
PS C:\windows\system32> python
python.exe : Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
At line:1 char:7
+ python <<<<
+ CategoryInfo : NotSpecified: (Python 2.7.6 (d...ntel)] on win32:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Type "help", "copyright", "credits" or "license" for more information.
最佳答案
这可能是由于 64 位/32 位不匹配造成的。假设您使用的是 64 位“Powershell”或“Powershell ISE”,请尝试在“Powershell (x86)”中运行 python 命令。
关于Powershell : Remote Exception and NativeCommandError 中的 Python 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22390395/