在Windows 10中为python 3创建虚拟环境时遇到问题

时间:2019-08-14 20:19:49

标签: python python-3.x windows powershell python-venv

我想在Windows 10中为python 3.7创建一个virtualenv

我正在尝试遵循python doc的指示

所以我首先输入了命令

PS T:\python -m venv c:\path\to\myenv

它确实在该路径中创建了目录和文件

然后根据文档,使用我输入的PowerShell:

PS T:\path\to\myenv\Scripts\Activate.ps1

但是我得到以下信息:


 The term
'T:\path\to\myenv\Scripts\Activate.ps1' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
+ T:\path\to\myenv\Scripts\Activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (T:\path\to\myenv...ts\Activate.ps1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我想念什么

1 个答案:

答案 0 :(得分:0)

您应该替换

DATA NM Escalation
DATA NM Escalation
DATA - SOM THIN Escalation
DATA - SOM THIN HEARTBEAT Escalation
DATA NM Escalation
DATA NM Escalation
DATA NM Escalation

到您的实际路径 如文档所述

path\to\myenv

例如应该是

C:\> <venv>\Scripts\Activate.ps1

另一种解决方法是手动将目录更改为Scripts文件夹,然后运行

C:\>MyProjectsFolder\first_project\venv\Scripts\Activate.ps1

如果不能解决您的问题,请指定您的项目文件夹和结构

相关问题