尝试在 Windows 上创建虚拟环境时 VS Code 出现错误
我正在尝试在 VS code 中创建一个虚拟环境来制作 Flask 应用程序。当我在 VS code 终端 pip install virtualenv
中运行命令后,所有内容都会下载,但出现错误警告:脚本 virtualenv.exe 安装在
C:\Users\NAME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
然后当我尝试使用此命令创建虚拟环境时命令 virtualenv env
我收到错误
virtualenv : The term 'virtualenv' 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.
I am trying to create a virtual environment in VS code to make a flask app. After I run the command in the VS code terminal pip install virtualenv
everything downloads find but I get the error WARNING: The script virtualenv.exe is installed in
C:\Users\NAME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Then when I try to create my virtual environment by using this command virtualenv env
I get the error
virtualenv : The term 'virtualenv' 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自 使用 pip 和虚拟环境安装包< /a>
要运行脚本,只需键入。无需输入完整位置:
From Installing packages using pip and virtual environments
To run the scripts just type. No need to put in the complete location:
您使用的是 Windows 应用商店中的 Python 吗?你最好避免它。
您可以从官方网站下载Python。
然后通过
venv
创建虚拟环境。您可以参考官方文档了解更多详细信息创建的虚拟环境。
Are you using Python from the Windows Store? You'd better avoid it.
You can download the python from the official site.
And then create the virtual environment through
venv
.You can refer to official docs for more details of the virtual environment created.
发生这种情况是因为目录(如您所提到的)
未添加到您的路径中
考虑此链接添加到 Windows 10 上的 PATH 并将目录添加到 PATH。
它会解决你的问题。
我也遇到了同样的问题,按照上面的方法解决了。
This is happening because the directory (as mentioned by you)
is not added to your PATH
Consider this link Add to the PATH on Windows 10 and add the directory to the PATH.
It's gonna solve your problem.
The same issue happened to me it solve it as said above.
转到
cmd
然后输入:在本例中,这是路径,但在您的路径中可能会有所不同
因此只需键入警告中指定的路径即可。
我也遇到了这个问题,花了三个多小时解决这个问题。
Go to
cmd
and then type:in this case this is the path but it might be different in yours
so just type the path that is specified in the warning.
I also had this issue and spend more than three hours fixing this.