python - Python: Cannot import from custom module
问题描述
I am having an issue with python not being able to find or import my module. I am unsure how to fix this problem. My py file I'm trying to get my import into is in 'main' folder, the file I'm trying to import is one level up. My program is a package:
解决方案
尝试将您的 .py 文件复制到Python 文件夹中的site-packages文件夹,然后从命令提示符 ( python -m <your_file_name>.py
)/python 启动器/IDE 运行您的 python 文件。如果您仍然遇到错误,请分享您的代码,以便人们可以看到。
推荐阅读
- angular - 新用户未使用 Angular 保存在 Firebase
- typescript - 订阅具有 2 个参数的事件发射器?
- linux - Linux 中延迟的内核恐慌
- php - 将 Coldfusion 转换为 PHP find('filename.cfm', cgi.script_name)
- ios - 运行 pod install 时 Flutter iOS 构建失败
- magento2 - 我在哪里可以找到我购买的扩展程序的用户名和密码
- schema.org - 在“组织”类型的网页上使用“mainEntityOfPage”和“CreativeWork”
- cakephp - 在 CakePHP 3 中烘焙自定义控制器模板
- sql - 根据 sql 中的条件为每组设置新的列值
- c# - POST方法调用Web API时的Modele绑定错误