Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/335.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 在Powershell下运行pip和virtualenv(记事本窗口)_Python_Windows_Powershell_Pip_Virtualenv - Fatal编程技术网

Python 在Powershell下运行pip和virtualenv(记事本窗口)

Python 在Powershell下运行pip和virtualenv(记事本窗口),python,windows,powershell,pip,virtualenv,Python,Windows,Powershell,Pip,Virtualenv,我在Linux下使用Python已经20多年了,但我对Windows完全陌生 我在WindowsServer2019上,试图将脚本从Bash移植到Powershell。该脚本设置了一个virtualenv,以使用pip安装各种库 基本上,我希望这能奏效: virtualenv --always-copy . .\Scripts\activate.ps1 .\Scripts\pip install -r .\requirements.txt 但是,当运行\Scripts\activate.ps1

我在Linux下使用Python已经20多年了,但我对Windows完全陌生

我在WindowsServer2019上,试图将脚本从Bash移植到Powershell。该脚本设置了一个virtualenv,以使用pip安装各种库

基本上,我希望这能奏效:

virtualenv --always-copy .
.\Scripts\activate.ps1
.\Scripts\pip install -r .\requirements.txt
但是,当运行
\Scripts\activate.ps1
时,它会弹出一个记事本窗口,因为我不确定是什么原因,我需要关闭记事本窗口,然后PS脚本才能继续。这是有问题的,因为当我使用SSH连接到Windows系统时(这是我主要的工作方式),我看不到任何记事本窗口,PS脚本只是挂起

另一方面,当我将
\Scripts\activate.ps1
替换为
\Scripts\activate.bat
时,PS脚本将在该行之后立即退出,而不进行pip调用

这是c:\program files\python39\lib\site packages\virtualenv\\uuuu init\uuuu.py中的
virtualenv 20.0.23

有人能帮我理解如何使
\Scripts\activate.ps1
不弹出记事本窗口吗?另外,
\Scripts\activate.bat
的作用是什么?多谢各位