注意:我在窗口10中新安装了vs代码
PS C:\Users\admin\Desktop\Kiit Project\django-ecommerce> source env/bin/activate
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.
+ source env/bin/activate
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (source:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
答案 0 :(得分:1)
假设您的虚拟环境的名称为env
,则只需进入目录(我认为 C:\ Users \ admin \ Desktop \ Kiit Project \ django-ecommerce 您的情况),然后运行env\Scripts\activate
。这应该可以完成工作。
但是,在VScode中,您可能必须编辑settings.json
文件夹中的.vscode
文件并添加以下内容:
{
...
"python.pythonPath": "C:\Users\admin\Desktop\Kiit Project\django-ecommerce\env\bin\python",
...
}
如果找不到上述settings.json
文件,只需按Ctrl+Shift+P
并键入python Select Interpreter
,然后按Enter
。然后,您将看到一个.vscode
目录,其中包含您的settings.json
文件。
您可以编辑此文件,但是要更改要用于VScode实例的Python解释器。