Python-进口本地建造的Python轮

发布于 2025-01-28 03:37:54 字数 1121 浏览 2 评论 0原文

拜托,谁能提出为什么我不能导入我的 python library

我要做的步骤:

  1. 转到beautify_table文件夹
  2. 运行python setup.py sdist bdist_wheel
  3. run pip install intermant install intermant install intermant intermife intermify_table-0.table-0.1-py3-none-anone.whl
  4. 运行python(jupyter笔记本或终端中)
  5. 在python i运行import import abletify_table
  6. 我得到错误:no Module no Module note beautify_table

在以下机器:

  • Windows 10,Python 3.9.5
  • MacOS 12.1,Python 3.8.6

那怎么样?我想念什么?

编辑:

现在,我能够import abotify_table在python控制台内(在VENV中),但是当我无法incode> import emotify_table我想运行的其他模块中包括。

#module_I_want_to_run.py
import beautify_table

命令:Python Module_i_want_to_run.py

错误:modulenotfoundError:no note noce

Please, can anyone suggest why I am not able to import my python library?

Steps I do:

  1. Go to beautify_table folder
  2. Run python setup.py sdist bdist_wheel
  3. Run pip install dist/beautify_table-0.1-py3-none-any.whl
  4. Run python (either jupyter notebook or in terminal)
  5. In python I run import beautify_table
  6. I get an error: No module named beautify_table

Tried on following machines:

  • Windows 10, python 3.9.5
  • macOS 12.1, python 3.8.6

How is that? What am I missing?

EDIT:

Now I am able to to import beautify_table inside python console (while being inside venv), however I am not able to import beautify_table when included in other module I want to run.

#module_I_want_to_run.py
import beautify_table

Command: python module_I_want_to_run.py

Error:ModuleNotFoundError: No module named 'beautify_table'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

儭儭莪哋寶赑 2025-02-04 03:37:54

您的存储库有多个问题!

  • 而不是App,请使用beautify_table作为文件夹名称。 您会得到这个
$ pip freeze
beautify-table==0.1
$ python3
Python 3.6.0 (default, Jan 25 2022, 16:13:10)
[GCC Apple LLVM 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import beautify-table
  File "<stdin>", line 1
    import beautify-table
                   ^
SyntaxError: invalid syntax
>>> import app
>>> dir(app)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

否则,当我检查pip Freeze时,

  • ,我看到您已安装了Pakage,但是,我已经做导入app要使用您的资源,您的需求不会提及pandas < /code>在setup.py中。更喜欢使用sumplast.txt
>>> from app import beautify
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/sam/beautify_table/app/beautify.py", line 22, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

快乐编码的参考!

Your repository is having multiple issues!

  • Instead of app, use beautify_table as the folder name. Otherwise you get this
$ pip freeze
beautify-table==0.1
$ python3
Python 3.6.0 (default, Jan 25 2022, 16:13:10)
[GCC Apple LLVM 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import beautify-table
  File "<stdin>", line 1
    import beautify-table
                   ^
SyntaxError: invalid syntax
>>> import app
>>> dir(app)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

When I check pip freeze I see you pakage is installed but, I have do import app to use your resources

  • Your requirements does not mention pandas in setup.py. Prefer using a requirements.txt
>>> from app import beautify
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/private/tmp/sam/beautify_table/app/beautify.py", line 22, in <module>
    import pandas as pd
ModuleNotFoundError: No module named 'pandas'

Happy coding!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文