(我怀疑这与我在外部usb驱动器上创建了一个虚拟环境有关,但我不知道如何解决这个问题,因为昨晚它工作正常)
当我第二天尝试调试时,我的VS代码python脚本突然不再工作了。一切正常,我保存了脚本并睡着了。第二天醒来,重新启动VS代码,突然脚本不再运行。由于interpertor菜单中的某些原因,我甚至无法再选择VS代码中的环境
下面是一个错误,它似乎出现在一个名为 出于某些原因,“setup.py”:
Exception has occurred: AssertionError (note: full exception trace is shown but execution is paused at: <module>)
b'No module named C\r\n'
File "C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-install-qafef280\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\setup.py", line 109, in get_description
assert not stderr, stderr
File "C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-install-qafef280\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\setup.py", line 337, in main
long_description=get_description(),
File "C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-install-qafef280\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\setup.py", line 442, in <module>
main()
File "<string>", line 1, in <module> (Current frame)
以下是终端窗口的输出:
& e:/E_ProgramData/Python/Python391/Othello/Scripts/Activate.ps1
& : File E:\E_ProgramData\Python\Python391\Othello\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
+ & e:/E_ProgramData/Python/Python391/Othello/Scripts/Activate.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
及
ERROR: Command errored out with exit status 1:
command: 'e:\E_ProgramData\Python\Python391\Othello\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Yaseen Ahammed\\AppData\\Local\\Temp\\pip-install-qafef280\\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\\setup.py'"'"'; __file__='"'"'C:\\Users\\Yaseen Ahammed\\AppData\\Local\\Temp\\pip-install-qafef280\\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-pip-egg-info-xonu1kkr'
cwd: C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-install-qafef280\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
main()
File "C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-install-qafef280\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\setup.py", line 337, in main
long_description=get_description(),
File "C:\Users\Yaseen Ahammed\AppData\Local\Temp\pip-install-qafef280\psutil_3bb3fb77c9f54c76acc10f29c92e88d3\setup.py", line 109, in get_description
assert not stderr, stderr
AssertionError: b'No module named C\r\n'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
我不明白是什么改变了,为什么VS代码突然不想再工作了
我确实在我的外置USB硬盘上创建了一个名为“Otherlo”的新虚拟环境,你可以看到它正在尝试访问,但无法访问。奇怪的是,昨晚它工作正常,所以我不明白为什么它在重新启动VS代码后停止工作
我注意到的另一个新情况是,当我从外部驱动器上创建的环境文件夹中选择exe时,VS Code Python解释器不再显示“Otherlo”,而是在Python版本名旁边显示Otherlo,表示它昨晚选择了正确的环境
提前谢谢
尝试:
添加或确保已正确添加
PYTHONPATH
窗口,请遵循以下StackOverflow question如果未修复,请确保遵循以下条款:
Using Python environments in VS Code
StackOverflow How to setup virtual environment for Python in VS Code?
Dev.to
相关问题 更多 >
编程相关推荐