Python中文
首页
教程
问答
标签
搜索
登录
注册
IronPython子模块imp
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我对IronPython模块导入处理有一个一般性问题。你知道吗</p> <p>给定一个Python包,子模块可以通过相对引用相互引用。假设包名为biggle,其中的子模块是鸡肉.py以及鸭子.py. 鸡可以简单地作为“进口鸭”进口鸭,反之亦然。应用程序加载的Python脚本可以正确导入包,可以使用子模块,一切正常。你知道吗</p> <p>包的目录结构如下所示:</p> <pre><code>+ - Poultry | - __init__.py | - Duck.py L - Chicken.py </code></pre> <p>然而,当我打开鸭子.py以我的应用程序为例,我无法运行和调试它,因为IronPython在“import Chicken”行抛出一个导入错误,消息是“No module name Chicken”。你知道吗</p> <p>我知道这不是IronPython的问题,而是宿主应用程序的问题。最后的问题是,如何修改宿主应用程序以正确处理这些导入语句? 我应该在作用域中设置一些路径变量,还是什么?如何让Python引擎理解当前加载的文件是特定包的一部分?你知道吗</p> <p>欢迎任何意见:-)</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>您仍然需要输入<code>from Poultry import Chicken</code>来导入鸡肉。你不能只做<code>import Chicken</code>。从项目中的任何文件都是相同的。你知道吗</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
尽管Python中的所有内容都是引用,为什么Python导师在没有指针的列表中绘制字符串和整数?
9 回答
尽管python中的表达式为false,但循环仍在运行
1 回答
尽管python代码正确,但从nifi ExecuteScript处理器获取语法错误
8 回答
尽管Python在Neovim中工作得很好,但插件不能识别Neovim中的Python主机
2 回答
尽管python字典包含了大量的条目,但它并没有增长
4 回答
尽管python说模块存在,为什么我会得到这个消息?
7 回答
尽管setuptools和控制盘是最新的,但无法识别singleversionexternallymanaged
5 回答
尽管stdout和stderr重定向,但未捕获错误消息
7 回答
尽管Tensorboard的事件太大,但Tensorboard的步骤太少了
7 回答
尽管tkinter上的变量已更改,但显示未更改
1 回答
尽管try/except使用Python进行单元测试时出现断言错误
4 回答
尽管URL是sam,但仍会抛出“达到最大重定向”
5 回答
尽管url有效,Pandas仍读取url的\u csv错误
7 回答
尽管while中存在时间延迟,但LINUX线程的CPU利用率为100%(1)
5 回答
尽管x0在范围内,Scipy优化仍会引发ValueError
1 回答
尽管xpath正确,但使用selenium单击链接仍不起作用
5 回答
尽管下载了ffmpeg并设置了路径变量python,但没有后端错误
2 回答
尽管下载了i,但找不到型号“fr”
6 回答
尽管下载了plotnine包,但未获取名为“plotnine”的模块时出错
10 回答
尽管为所有行指定了权重,网格(0)仍不起作用
1 回答