Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 正在运行.py fin PowerShell(再次)_Python_Powershell - Fatal编程技术网

Python 正在运行.py fin PowerShell(再次)

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

为什么会这样?它不接受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
             ^
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电脑。算了吧。