为什么机械化不通过RPI上的PIP正确安装? (Python 3.9)

发布于 2025-02-09 08:31:49 字数 2833 浏览 3 评论 0原文

我无法在Virtualenv中成功安装与Debian Bullseye,Python 3.9的Raspberry Pi(So,Arm Chip)上的“机械化”。

当我在Virtualenv的SitePackages文件夹中查看时,实际上机械化包仅具有.dist-Info文件,而不是Mechanagize.py.py file> file> file> Mechanizize包装文件夹。见下文。

问题:我忽略了什么吗?

详细信息(1):使用PIP安装机械化

(venvtest) pi@mango:~/MyProject/myproj $ pip --version
pip 20.3.4 from /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages/pip (python 3.9)

(venvtest) pi@mango:~/MyProject/myproj $ pip install mechanize
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mechanize
Using cached https://www.piwheels.org/simple/mechanize/mechanize-0.4.8-py2.py3-none-any.whl (5.1 kB)
Requirement already satisfied: html5lib>=0.999999999 in /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages (from mechanize) (1.1)
Requirement already satisfied: webencodings in /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages (from html5lib>=0.999999999->mechanize) (0.5.1)
Requirement already satisfied: six>=1.9 in /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages (from html5lib>=0.999999999->mechanize) (1.16.0)
Installing collected packages: mechanize
Successfully installed mechanize-0.4.8


(venvtest) pi@mango:~/MyProject/myproj $ pip list
Package       Version
------------- -------
html5lib      1.1
mechanize     0.4.8
pip           20.3.4
pkg-resources 0.0.0
setuptools    44.1.1
six           1.16.0
webencodings  0.5.1
wheel         0.34.2

详细信息(2):Sitelibs中缺少包装文件夹

(venvtest) pi@mango:~/MyProject/myproj/ $ ls venvtest/lib/python3.9/site-packages
easy_install.py            pip-20.3.4.dist-info            __pycache__                   six.py                        wheel
html5lib                   pip-20.3.4.virtualenv           setuptools                    _virtualenv.pth               wheel-0.34.2.dist-info
html5lib-1.1.dist-info     pkg_resources                   setuptools-44.1.1.dist-info   _virtualenv.py                wheel-0.34.2.virtualenv
mechanize-0.4.8.dist-info  pkg_resources-0.0.0.dist-info   setuptools-44.1.1.virtualenv  webencodings
pip                        pkg_resources-0.0.0.virtualenv  six-1.16.0.dist-info          webencodings-0.5.1.dist-info

详细信息(3):结果,导入,导入机械化行不通

(venvtest) pi@mango:~/MyProject/myproj $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mechanize'
>>> exit()

I can't get to successfully install the package 'mechanize' on a Raspberry Pi (so, ARM chip) with Debian Bullseye, python 3.9 in a virtualenv.

When I look in the virtualenv's sitepackages folder, indeed the mechanize package only has .dist-info file, but not a mechanize.py file or mechanize package folder. See below.

Question: Am I overlooking something?

Details (1): Installing mechanize with pip

(venvtest) pi@mango:~/MyProject/myproj $ pip --version
pip 20.3.4 from /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages/pip (python 3.9)

(venvtest) pi@mango:~/MyProject/myproj $ pip install mechanize
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting mechanize
Using cached https://www.piwheels.org/simple/mechanize/mechanize-0.4.8-py2.py3-none-any.whl (5.1 kB)
Requirement already satisfied: html5lib>=0.999999999 in /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages (from mechanize) (1.1)
Requirement already satisfied: webencodings in /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages (from html5lib>=0.999999999->mechanize) (0.5.1)
Requirement already satisfied: six>=1.9 in /home/pi/MyProject/myproj/venvtest/lib/python3.9/site-packages (from html5lib>=0.999999999->mechanize) (1.16.0)
Installing collected packages: mechanize
Successfully installed mechanize-0.4.8


(venvtest) pi@mango:~/MyProject/myproj $ pip list
Package       Version
------------- -------
html5lib      1.1
mechanize     0.4.8
pip           20.3.4
pkg-resources 0.0.0
setuptools    44.1.1
six           1.16.0
webencodings  0.5.1
wheel         0.34.2

Details (2): Package folder missing in sitelibs

(venvtest) pi@mango:~/MyProject/myproj/ $ ls venvtest/lib/python3.9/site-packages
easy_install.py            pip-20.3.4.dist-info            __pycache__                   six.py                        wheel
html5lib                   pip-20.3.4.virtualenv           setuptools                    _virtualenv.pth               wheel-0.34.2.dist-info
html5lib-1.1.dist-info     pkg_resources                   setuptools-44.1.1.dist-info   _virtualenv.py                wheel-0.34.2.virtualenv
mechanize-0.4.8.dist-info  pkg_resources-0.0.0.dist-info   setuptools-44.1.1.virtualenv  webencodings
pip                        pkg_resources-0.0.0.virtualenv  six-1.16.0.dist-info          webencodings-0.5.1.dist-info

Details (3): As a consequence, importing mechanize doesn't work

(venvtest) pi@mango:~/MyProject/myproj $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'mechanize'
>>> exit()

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

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

发布评论

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

评论(3

┾廆蒐ゝ 2025-02-16 08:31:49

它似乎是版本0.4.8的问题。安装0.4.7的版本正常工作:

pip install mechanize==0.4.7

可以看出:

(venvtest) pi@mango:~/MyProj/myproj $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
>>> print(mechanize.__version__)
(0, 4, 7, None, None)

我已经在机械化github存储库上打开了一张票: https://github.com/python-mechanize/mechanize/mechanize/issues/76

It appears to be an issue with version 0.4.8. Installing version 0.4.7 works fine:

pip install mechanize==0.4.7

as can be seen:

(venvtest) pi@mango:~/MyProj/myproj $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mechanize
>>> print(mechanize.__version__)
(0, 4, 7, None, None)

I've opened a ticket at the mechanize github repository: https://github.com/python-mechanize/mechanize/issues/76

乖不如嘢 2025-02-16 08:31:49

我已经找到了这个线程:

孤独患者 2025-02-16 08:31:49

“ sudo pip3安装机械”
为我工作

"sudo pip3 install mechanize"
Worked for me

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