繁体   English   中英

我无法在 Windows 10 上激活 virtualenv

[英]I cannot activate virtualenv on windows 10

我正在尝试使用以下命令在 Windows 10x64 上激活 virtualenv:

source \env\Scripts\activate.bat

但我收到此错误:

source : The term 'source' 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
+ source \env\Scripts\activate.bat
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (source:String) [], CommandNotFoundException  
    + FullyQualifiedErrorId : CommandNotFoundException

好的,source 是一个 shell 命令,仅用于 Linux 系统,但不适用于 Windows 系统。 在窗口中,您应该将其运行为...(假设目录位于 C 内部:)

C:\Users\env\Scripts\activate.bat

我在 Windows 10 上也遇到了同样的问题。 不幸的是, source只能在基于 Linux 的系统上使用。 经过几个兔子洞搜索,我能够解决它。 假设您的目录如下所示:

C:\Users\Workspace> 

只需在前面输入:

C:\Users\Workspace> .\virt_env\Scripts\activate

假设virt_env是您的虚拟环境的名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM