Python 正在运行.py fin PowerShell(再次)
为什么会这样?它不接受C:\Python 正在运行.py fin PowerShell(再次),python,powershell,Python,Powershell,为什么会这样?它不接受C:\ Set-Location C:\Python27\Tools\Scripts\pyscripts ^ SyntaxError: invalid syntax >>> Set-Location c:\Python27\Tools\Scripts\pyscripts File "<stdin>", line 1 Set-Location c:\Python27\Tools\Scripts\pyscripts
Set-Location C:\Python27\Tools\Scripts\pyscripts
^
SyntaxError: invalid syntax
>>> Set-Location c:\Python27\Tools\Scripts\pyscripts
File "<stdin>", line 1
Set-Location c:\Python27\Tools\Scripts\pyscripts
^
SyntaxError: invalid syntax
设置位置C:\Python27\Tools\Scripts\pyscripts
^
SyntaxError:无效语法
>>>设置位置c:\Python27\Tools\Scripts\pyscripts
文件“”,第1行
设置位置c:\Python27\Tools\Scripts\pyscripts
^
SyntaxError:无效语法
当Powershell和Python混合使用时会发生这种情况。在这种情况下,您将在Python脚本中使用Powershell命令,或者将其键入Python解释器。Python不理解Set Location
命令,因此它会抱怨。无法重现您的问题,您是否尝试过cd
?另外,出于好奇,您是否出于任何特殊原因需要Set-Location
cmdlet而不是更常见的cd
?@K.J.Phan,因为cd
是Set-Location
cmdlet的别名。使用Get Alias
进行验证。cd C:\Python27\Tools\Scripts\pyscripts给出了相同的无效语法错误。我要用我的Mac电脑。算了吧。