简体   繁体   English

virtualenv 到 Windows 10 上的路径

[英]virtualenv to path on Windows 10

I have installed virtualenv (if I type "pip list" there is virtualenv (15.1.0)) and when I try to use it throws an error:我已经安装了 virtualenv(如果我输入“pip list”,则有 virtualenv (15.1.0)),当我尝试使用它时会抛出一个错误:

virtualenv: The term 'virtualenv' is not recognized as the name of a cmdlet, function, script file, or operable program. virtualenv:术语“virtualenv”未被识别为 cmdlet、function、脚本文件或可运行程序的名称。 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在行:1 字符:1

 + virtualenv + ~~~~~~~~~~ + CategoryInfo: ObjectNotFound: (virtualenv:String) [], CommandNotFoundException + FullyQualifiedErrorId: CommandNotFoundException

I think I need to add virtualenv to path, which I've tried without success.我想我需要将 virtualenv 添加到路径中,我尝试过但没有成功。

To install :安装 :

pip install --user virtualenv

To create a virtual environment (venv):创建虚拟环境 (venv):

python -m virtualenv venv

To activate:激活:

-cd venv
-cd Scripts
-activate.bat

to deactivate:停用:

-deactivate.bat

to run venv again just type activate.bat再次运行 venv 只需键入 activate.bat

Note: had problems with the platformio integrated terminal, used cmd from within the folder.注意:platformio 集成终端有问题,使用文件夹中的 cmd。 Hope this helps!希望这可以帮助!

  1. create a virtual environment创建虚拟环境

    python -m virtualenv demoEnv python -m virtualenv demoEnv

  2. Activate the environment激活环境

    demoEnv\Scripts\activate演示环境\脚本\激活

  3. To deactivate停用

    deactivate停用

PS> python -m venv venv

If you're using Python on Windows and you haven't configured the PATH and PATHEXT variables, then you might need to provide the full path to your Python executable:如果您在 Windows 上使用 Python 并且尚未配置 PATH 和 PATHEXT 变量,那么您可能需要提供 Python 可执行文件的完整路径:

PS> C:\Users\Name\AppData\Local\Programs\Python\Python310\python -m venv venv

Activate It激活它

PS> venv\Scripts\Activate

(venv) PS>

Install Packages Into It将软件包安装到其中

(venv) PS> python -m pip install <package-name>

Deactivate It停用它

(venv) PS> deactivate

PS>

do ls and see for the files and folders existing within that django folder created执行 ls 并查看创建的 django 文件夹中存在的文件和文件夹

ls ls

next .\filename or .\folder\filename下一个 .\filename 或 .\folder\filename

this way we can activate the virtual environment I did这样我们就可以激活我做的虚拟环境

ls ls

to activate激活

.\activate 。\启用

then virtual environment starts然后虚拟环境启动

to deactivate停用

.\deactivate .\停用

.\activate.bat .\激活.bat

that seems to help on windows11这似乎对windows11有帮助

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

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