如何导入已经安装的Python模块“ Bitstring”

发布于 2025-02-02 18:04:11 字数 774 浏览 5 评论 0原文

我在Windows上,从克隆的GitHub存储库中处理Python文件。尝试这样做时,

import bitstring as bs

我会收到此错误:

ModuleNotFoundError: No module named 'bitstring'

但是“ PIP列表”显示了它。

我试图卸载并重新安装它,然后可以使用 pip install bitstring 安装它。问题与导入模块有关。

它的位置为 d:\ program \ anaconda \ lib \ lib \ site-packages ,与numpy相同,我可以毫无问题地导入。

使用 python -m pip安装bittring 在写作时不起作用

import sys
for p in sys.path:
    print(p)

我看到与在终端中键入时相同的位置:

pip show bitstring

我还向环境变量添加了PIP路径,但是问题仍然存在遗迹。

通过编写以下内容,代码运行,但是模块名称仍然被强调为“ NotFound”,并且调试给出了错误。

import sys
sys.path.append(r'd:\\programs\\anaconda\\lib\site-packages')

I'm on Windows and working on a python file from a cloned gitHub repository. When trying to do

import bitstring as bs

I get this error:

ModuleNotFoundError: No module named 'bitstring'

But "pip list" shows it.

I tried to uninstall and reinstall it and I can install it just fine with pip install bitstring. The problem is related to importing the module.

Its location is d:\programs\anaconda\lib\site-packages , same as numpy, which I can import without problems.

Installing it with python -m pip install bitstring doesn't work

When writing:

import sys
for p in sys.path:
    print(p)

I see the same location as when typing in the terminal:

pip show bitstring

I also added the pip path to the environment variables, but the problem still remains.

By writing the following, the code runs, but the module name still remains highlighted as "NotFound", and the debugging gives an error.

import sys
sys.path.append(r'd:\\programs\\anaconda\\lib\site-packages')

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文