我在 VS2012 中使用 python 导入时遇到问题。使用导入时,我无法编译/运行项目。如果我没有任何导入,python 将运行 main ok(并打印“hello world”)。这似乎是 VS 的错误,可能是配置,因为当我在 VS 中禁用异常时,它运行良好。
起初它错误地说:
[WinError 2] The system cannot find the file specified
如果我继续几次,它会显示:
[WinError 2] The system cannot find the file specified: 'C:\\Users\\Drew Cross\\Documents\\Visual Studio 2012\\Projects\\Test\\Model\\__init__.pyd'
然后它终于在继续运行了几次。
我有以下目录结构:
main.py
Model
/__init__.py
/graph.py
主要.py:
import Model.graph
def main():
print('Hello World')
if __name__ == '__main__':main()
图.py:
class graph():
def __init__(self):
neighbors = []