主要解决的问题是python在linux下包没办法安装的问题
Traceback (most recent call last):
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 202, in
w = Window()
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 95, in init
self.initWindow()
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 156, in initWindow
self.setQss()
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 173, in setQss
with open(f’resource/dark/demo.qss’, encoding=‘utf-8’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘resource/dark/demo.qss’
PS E:\Github\Python-GUI\PyQt-Fluent-Widgets> & C:/Users/11868/AppData/Local/Programs/Python/Python310/python.exe e:/Github/Python-GUI/PyQt-Fluent-Widgets/examples/navigation/demo.py
QImage::scaled: Image is a null image
Traceback (most recent call last):
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 202, in
w = Window()
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 95, in init
self.initWindow()
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 156, in initWindow
self.setQss()
File “e:\Github\Python-GUI\PyQt-Fluent-Widgets\examples\navigation\demo.py”, line 173, in setQss
with open(f’resource/{color}/demo.qss’, encoding=‘utf-8’) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘resource/light/demo.qss’
一直都用vscode编写python,个人觉得vscode界面美观,功能强大,关键是打开速度很是让我满意。
今天出问题了,我把别人的写的源码复制到我的vscode工作目录下的一个子目录里,然后打开里面的py文件运行,出现 FileNotFoundError: [Errno 2] No such file or directory 的错误,检查源码没有发现问题,出现问题的代码是读取一个文件出错,而这个文件明明就在当前的文件夹里,但为何读取不到?用pycharm打开源码来运行没有问题,说明源码没有问题,问题可能出在:我把源码复制到vscode默认的工作目录下的子文件夹里,但运行源码时,vscode默认是会去工作目录里去找文件,我把相关的问题复制一份到工作目录里,问题立即解决,就证明我的猜想。
打开菜单:文件 --> 首选项 --> 设置,打开设置界面后,在搜索框输入:execute
上面勾选的意思是:
python>终端:在文件目录中执行
在终端中执行文件时,是否使用文件目录中的execute,而不是当前打开的文件夹