11

任何人都知道如何解决这个问题?来自控制台的堆栈跟踪,执行后报告错误:

    InstaPy Version: 0.6.9
    ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
    Workspace in use: "/home/zanettra/InstaPy"
    Error, unable to determine correct filename for 64bit linux
    Traceback (most recent call last):
    File "unfollow.py", line 24, in <module>
    headless_browser=False)
    File "/usr/local/lib/python3.6/dist-packages/instapy/instapy.py", line 
    322, in __init__
    self.logger,
      File "/usr/local/lib/python3.6/dist-packages/instapy/browser.py", line 114, in set_selenium_local_session
        driver_path = geckodriver_path or get_geckodriver()
      File "/usr/local/lib/python3.6/dist-packages/instapy/browser.py", line 36, in get_geckodriver
        sym_path = gdd.download_and_install()[1]
      File "/usr/local/lib/python3.6/dist-packages/webdriverdownloader/webdriverdownloader.py", line 177, in download_and_install
        show_progress_bar=show_progress_bar)
      File "/usr/local/lib/python3.6/dist-packages/webdriverdownloader/webdriverdownloader.py", line 129, in download
        download_url = self.get_download_url(version, os_name=os_name, bitness=bitness)
      File "/usr/local/lib/python3.6/dist-packages/webdriverdownloader/webdriverdownloader.py", line 324, in get_download_url
        raise RuntimeError(info_message)
    RuntimeError: Error, unable to determine correct filename for 64bit linux
4

3 回答 3

19

这个问题与 InstaPy 无关,而是来自 webdriverdownloader 的 webdriverdownloader.py。对于 Ubuntu,您可以使用sudo apt install firefox-geckodriver; 其他操作系统将有类似的解决方案来安装 geckodirver。


对于 macOS 用户,问题是由于 macOS 中的新拱 ARMgeckodriver-v0.30.0-macos.tar.gzgeckodriver-v0.30.0-macos-aarch64.tar.gz

2021 年 11 月可用版本:

['geckodriver-v0.30.0-linux32.tar.gz', 'geckodriver-v0.30.0-linux32.tar.gz.asc', 'geckodriver-v0.30.0-linux64.tar.gz', 'geckodriver-v0.30.0-linux64.tar.gz.asc', 'geckodriver-v0.30
.0-macos-aarch64.tar.gz', 'geckodriver-v0.30.0-macos.tar.gz', 'geckodriver-v0.30.0-win32.zip', 'geckodriver-v0.30.0-win64.zip']

GeckoDriverDownloader您可以使用以下内容为->修补文件site-packages/webdriverdownloader/webdriverdownloader.py

   1   │ diff --git a/Users/user/GitHub/InstaPy/venv39/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py b/Users/user/GitHub/InstaPy/venv39/lib/python3.9/
       │ site-packages/webdriverdownloader/webdriverdownloader_patch.py
   2   │ index bc01c2d..057862a 100644
   3   │ --- a/Users/user/GitHub/InstaPy/venv39/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader.py
   4   │ +++ b/Users/user/GitHub/InstaPy/venv39/lib/python3.9/site-packages/webdriverdownloader/webdriverdownloader_patch.py
   5   │ @@ -382,6 +382,13 @@ class GeckoDriverDownloader(WebDriverDownloaderBase):
   6   │              )
   7   │              logger.error(info_message)
   8   │              raise RuntimeError(info_message)
   9   │ +        # macos is only available for 64bit, 32bit is deprectated
  10   │ +        # geckodriver is available for x64 and aarch64, this is why the "RuntimeError: Error, unable to determine correct filename for 64bit macos"
  11   │ +        # geckodriver-v0.30.0-macos.tar.gz
  12   │ +        # geckodriver-v0.30.0-macos-aarch64.tar.gz
  13   │ +        if os_name == "macos":
  14   │ +            bitness = ".tar.gz"  # no bitness for macos since it is 64bit only. Use the extension for tar.gz
  15   │ +
  16   │          if len(filename) > 1:
  17   │              filename = [name for name in filenames if os_name + bitness in name]
  18   │              if len(filename) != 1:
于 2020-09-23T13:34:30.653 回答
1

在 Macos 上添加对我有用的东西。

最简单的做法是从官方最新的 github 链接下载驱动程序并解压缩 zip 文件夹。

创建一个 virtualenv 并在 virtualenv 的 bin 文件夹中添加 geckodriver 可执行文件。

您还可以使用 sys.path 手动添加 geckodriver 的路径,如下所示:

import sys
sys.path.insert(0,'/Users/myfolder/Downloads/geckodriver')

但由于某种原因,这对我不起作用。Virtualenv 解决方案工作正常。

于 2021-04-11T18:24:45.950 回答
0

解决方案发布在这里:https ://github.com/leonidessaguisagjr/webdriverdownloader/pull/12

您必须更改 webdriverdownloader.py 中的一行

filename = [name for name in filenames if os_name + bitness in name]

filename = [name for name in filenames if os_name + bitness in name and name[-3:] != 'asc' ]

该文件存储在我的系统中的路径是home/kali/.local/lib/python3.7/site-packages/webdriverdownloader

我曾经pip3 install webdriverdriverdownloader找到它的存储位置

于 2021-10-14T16:04:31.423 回答