简体   繁体   English

Python 找不到我的自定义模块

[英]Python can't find my custom module

I tried following this tutorial The Instructions I Followed我尝试按照本教程我遵循的说明

but I think I messed it up somehow (I am relatively new to python)但我想我把它搞砸了(我对 python 比较陌生)

I get this error when I try to import it.尝试导入时出现错误。 Does anyone have any ideas how to fix it or what I did wrong.有没有人有任何想法如何解决它或我做错了什么。 (I tried looking for help but they were all a bit confusing for me) (我试图寻求帮助,但他们都让我有点困惑)

This is the contents of vigenere.py是 vigenere.py 的内容

I guess that the file/folder ( vigenere.py ) you are trying to import not is in you import path.我猜您尝试导入的文件/文件夹( vigenere.py )不在您的导入路径中。

From within a python file, you can add path(s) incidentally to the default path by adding the following lines in the head section of your python application or script: import sys sys.path.insert(0, "/path/to/your/package_or_module")从 python 文件中,您可以通过在 python 应用程序或脚本的 head 部分添加以下行来顺便将路径添加到默认路径: import sys sys.path.insert(0, "/path/to/your/package_or_module")

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

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