【发布时间】:2020-03-07 03:15:31
【问题描述】:
我想在我的 Workspace 中设置一个 python3 虚拟环境。我有两个版本的python,安装在以下路径:C:\Python\Python27\python2.exeC:\Python\Python38\python3.exe。我已经在 powershell 终端上检查了它们是否已正确安装。
我尝试了命令python3 -m venv .venv。它创建了一个.venv 文件夹,但我收到以下错误消息:"Error: [Win Error2] The system cannot find the file specified。
我的 IDE 是 Visual Studio Code 1.39.2
另外,在Variable环境C:\Python\Python38的路径中添加了Python3
我也尝试使用命令py -3 -m venv .venv,但后来我得到:
Python 3 not found! Installed Pythons found by C:\WINDOWS\py.exe
launchers for Windows
No Installed Pythons found
我也已经执行了命令Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process,但没有任何改变。
我的 settings.json 文件:
{ "python;pythonPath": "C:\\Python\\Python38\\python3.exe" }
我的 pyvenv.cfg 文件:
home = C:\Python\Python38
include-system-site-package = false
version = 3.8.0
【问题讨论】:
-
你试过把你的python放在你的环境变量上吗?
-
是的,python2 和 3 都在我的环境变量中,用于用户和系统变量
-
不知何故,对我来说,
py命令是让它工作的原因。
标签: python visual-studio python-venv