如何使用Python在Django for Windows中激活虚拟环境? [英] How to activate virtual environment in Django for Windows with Python?

查看:87
本文介绍了如何使用Python在Django for Windows中激活虚拟环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人告诉我要在Windows的Django中激活虚拟环境,我应该尝试:

I've been told that to activate a Virtual Environment in Django for Windows I should try:

environment_path\Scripts\activate

但是当我输入该命令时,cmd返回此错误:

But when I enter that, cmd returns this error:

系统找不到指定的路径.

The system cannot find the path specified.

我通过输入以下内容来创建虚拟环境:

I created the virtual environment by entering:

python3 -m venv env

但是,当我尝试 env \ Scripts \ activate 时,我得到了描述的错误.

However when I try env\Scripts\activate I get the error described.

任何人都可以帮忙吗?谢谢.

Can anyone help? Thanks.

推荐答案

您可以在 windows 中创建虚拟环境,如下所示: py -m venv myenv (此处 myenv 是用户提供的名称.可以是您想要的任何名称)

You can create virtual environment in windows as: py -m venv myenv (Here myenv is the name that users give. It can be anything you want)

现在要激活您的myenv虚拟环境类型: myenv \ scripts \ activate

Now to activate your myenv virtual environment type:myenv\scripts\activate

要停用虚拟环境,只需键入:停用

To deactivate virtual environment simply type: deactivate

这篇关于如何使用Python在Django for Windows中激活虚拟环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆