pip安装轮后导入模块
我有一个自定义的构建模块,我们将其称为 abc
和 pip install /local_path/abc-0.1-py3-none-any.whl
。安装正确,
>>pip install dist/abc-0.1-py3-none-any.whl
Processing ./dist/abc-0.1-py3-none-any.whl
Successfully installed abc-0.1
但无法导入模块。 我运行 ppip freeze list 并发现列表中的模块名称是 abc @ file:///local_path/abc-0.1-py3-none-any.whl 后。
我的问题是如何导入模块?谢谢
.
├── requirements.txt
├── setup.py
├── src
│ ├── bin
│ │ ├── __init__.py
│ │ ├── xyz1.py
│ │ ├── xyz2.py
│ │ └── xyz3.py
,这是我的 setup.py
with open("requirements.txt") as f:
install_requires = f.read()
setup(
name="abc",
version="0.1",
author="galaxyan",
author_email="[email protected]",
description="test whell framework",
packages=find_packages(include=["src"]),
zip_safe=False,
install_requires=install_requires,
)
############ 更新 ############
即使更改 setup.py 也不起作用
with open("requirements.txt") as f:
install_requires = f.read()
setup(
name="abc",
version="0.1",
author="galaxyan",
author_email="[email protected]",
description="test whell framework",
packages=find_packages(where="src"),
package_dir={"": "src"},
zip_safe=False,
install_requires=install_requires,
)
I have a customized built module, lets call it abc
, and pip install /local_path/abc-0.1-py3-none-any.whl
. Installation is correct,
>>pip install dist/abc-0.1-py3-none-any.whl
Processing ./dist/abc-0.1-py3-none-any.whl
Successfully installed abc-0.1
but I could not import the module.
After I ran ppip freeze list
and found out the name of module in list is abc @ file:///local_path/abc-0.1-py3-none-any.whl
.
my question is how could import the module? Thank you
.
├── requirements.txt
├── setup.py
├── src
│ ├── bin
│ │ ├── __init__.py
│ │ ├── xyz1.py
│ │ ├── xyz2.py
│ │ └── xyz3.py
here is my setup.py
with open("requirements.txt") as f:
install_requires = f.read()
setup(
name="abc",
version="0.1",
author="galaxyan",
author_email="[email protected]",
description="test whell framework",
packages=find_packages(include=["src"]),
zip_safe=False,
install_requires=install_requires,
)
############ update ############
it does not work even change setup.py
with open("requirements.txt") as f:
install_requires = f.read()
setup(
name="abc",
version="0.1",
author="galaxyan",
author_email="[email protected]",
description="test whell framework",
packages=find_packages(where="src"),
package_dir={"": "src"},
zip_safe=False,
install_requires=install_requires,
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
setup.py
是错误的,这意味着您正在构建内部没有包装的车轮。而不是
尝试以下操作:
请参阅 testing&包装有关更多信息。
The
setup.py
is wrong, which means you're building a wheel with no packages actually inside.Instead of
Try this:
See Testing & Packaging for more info.