python - 无法在 Powershell 上激活 Virtualenv
问题描述
我正在尝试学习 Django。首先,我需要安装 Python、Django 和 Virtualenv。这些都安装没有错误。但是现在我想启动一个项目并运行 virtualenv,我无法在 powershell 中激活它。
我用这个命令制作了一个 virtualenv:
python -m virtualenv venv
现在教程说我必须像这样激活 virtualenv:
. \scripts\activate
但它给了我这个错误:
. : The term '\scripts\activate' 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:3
+ . \scripts\activate
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\scripts\activate:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我应该怎么办?
我已经尝试过scripts\activate.ps1
,但它仍然无法正常工作。
解决方案
您应该使用scripts\activate.ps1
而不是scripts\activate
. 在此处查找更多信息
推荐阅读
- excel - Excel VBA Do While循环在目录文件夹和行数中
- scikit-learn - 使用 scikit learn 进行标签编码时如何保持自然顺序
- typescript - 如何基于类泛型定义泛型接口
- flutter - scoped_model 的用途/提供包(如果内置状态管理有效)
- php - ssh2_connect 定义显式 TLS
- postgresql - 在安装了 PostgreSQL 12.1 的 MacOS catalina 上的 virtualenv 中安装 psycopg2 是否有任何问题?
- html - 如何模糊背景
- jquery - select2下拉列表的jquery验证弹出位置问题
- ios - 错误:使用未声明的标识符“SSL_get_secure_renegotiation_support”;您的意思是“GRPC_SHADOW_SSL_get_secure_renegotiation_support”吗?
- javascript - lightGallery.js 视频库不工作