简体   繁体   English

为什么我不能在 python 的 VSCode 中导入我的文件?

[英]Why can't I import my files in VSCode in python?

This morning I tried to import a file that I created into another file but the file name that I am trying to import has the yellow scribble line under it.今天早上,我尝试将创建的文件导入另一个文件,但我尝试导入的文件名下方有黄色涂鸦线。 I know this is an import error but I can't fix it.我知道这是一个导入错误,但我无法修复它。 I am working in VSCode on Windows 10 in python.我在 python 的 Windows 10 上使用 VSCode。 The files are in the same directory.这些文件位于同一目录中。

I tried to import the path of the file but it doesn't work.我试图导入文件的路径,但它不起作用。

在此处输入图像描述

I had an old working file which requires me to import another file into it but now it doesn't work as well.我有一个旧的工作文件,需要我将另一个文件导入其中,但现在它不能正常工作。 Is this a new bug in VSCode?这是 VSCode 中的新错误吗?

Any help would be appreciated.任何帮助,将不胜感激。

you can try: path/to/python3 -m path/to/script.py你可以试试: path/to/python3 -m path/to/script.py

or just specify the full path: 'C://Users/quina//...//word.txt'或者只指定完整路径:'C://Users/quina//...//word.txt'

Maybe try to use the normale python3 IDLE or throught the terminal just to understand you error.也许尝试使用正常的 python3 IDLE 或通过终端只是为了理解你的错误。

There is no word.txt in 'Visual Studio Projects' folder “Visual Studio Projects”文件夹中没有 word.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM