错误场景

正在“D:\Projects\VisualStudio\DjangoWebProject1\venv”中创建虚拟环境
Error: [Errno 2] No such file or directory: 'D:\\Libraries\\Python37\\lib\\venv\\scripts\\nt\\python_d.exe'
未在“D:\Projects\VisualStudio\DjangoWebProject1\venv”中创建虚拟环境。退出代码: 1
正在“D:\Projects\VisualStudio\DjangoWebProject1\venv”中创建虚拟环境
Error: [Errno 2] No such file or directory: 'D:\\Libraries\\Python37\\lib\\venv\\scripts\\nt\\python_d.exe'
未在“D:\Projects\VisualStudio\DjangoWebProject1\venv”中创建虚拟环境。退出代码: 1

解决方案

本人Python解释器是3.7的版本,安装在D:\Libraries\Python37下,因此将在D:\Libraries\Python37的部分文件拷贝到D:\Libraries\Python37\Lib\venv\scripts\nt

文件名如下:

python_d.exe
python_d.pdb
python37_d.dll
python37_d.pdb
pythonw_d.exe
pythonw_d.pdb

参考:https://stackoverflow.com/questions/55380296/how-to-fix-error-errno-2-no-such-file-or-directory-c-program-files-pytho