简体   繁体   English

为什么 mechanize 无法通过 RPi 上的 pip 正确安装? (蟒蛇3.9)

[英]Why is mechanize not installing properly via pip on RPi? (python 3.9)

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.我无法在虚拟环境中使用 Debian Bullseye、python 3.9 在 Raspberry Pi(因此,ARM 芯片)上成功安装包“mechanize”。

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.当我查看 virtualenv 的 sitepackages 文件夹时,实际上 mechanize 包只有.dist-info文件,但没有mechanize.py文件或mechanize包文件夹。 See below.见下文。

Question : Am I overlooking something?问题:我是否忽略了什么?

Details (1) : Installing mechanize with pip详情(一) :用pip安装mechanize

(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详情(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

Details (3) : As a consequence, importing mechanize doesn't work细节(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()

我找到了这个线程: https ://github.community/t/python-modulenotfounderror-although-module-is-installed-aiohttp/15425,这有帮助吗?

It appears to be an issue with version 0.4.8.这似乎是版本 0.4.8 的问题。 Installing version 0.4.7 works fine:安装 0.4.7 版可以正常工作:

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我在 mechanize github 存储库中开了一张票: https ://github.com/python-mechanize/mechanize/issues/76

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM