max32002 / tixcraft_bot

MaxBot open source code bot
https://max-everyday.com/2018/03/tixcraft-bot/
GNU General Public License v3.0
5 stars 3 forks source link

[Python 3.12+] ModuleNotFoundError: No module named 'distutils' #104

Closed visonliamazon closed 11 months ago

visonliamazon commented 1 year ago

Python 3.12 以上版本會遇到以下錯誤

Traceback (most recent call last):
  File "/Applications/MaxBot.app/Contents/Resources/chrome_tixcraft.py", line 11478, in <module>
    cli()
  File "/Applications/MaxBot.app/Contents/Resources/chrome_tixcraft.py", line 11433, in cli
    main(args)
  File "/Applications/MaxBot.app/Contents/Resources/chrome_tixcraft.py", line 11255, in main
    driver = get_driver_by_config(config_dict)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/MaxBot.app/Contents/Resources/chrome_tixcraft.py", line 704, in get_driver_by_config
    driver = load_chromdriver_uc(config_dict)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Applications/MaxBot.app/Contents/Resources/chrome_tixcraft.py", line 562, in load_chromdriver_uc
    import undetected_chromedriver as uc
  File "/Applications/MaxBot.app/Contents/Resources/undetected_chromedriver/__init__.py", line 44, in <module>
    from .patcher import IS_POSIX
  File "/Applications/MaxBot.app/Contents/Resources/undetected_chromedriver/patcher.py", line 4, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

執行環境:

推測是因為python 12移除了distuilts Issue: https://github.com/python/cpython/issues/85454

visonliamazon commented 1 year ago

結論:直接用windows執行比較簡單 😅

感謝Max大的開發 🙏

max32002 commented 1 year ago

如果您是使用 macOS + python 3.12.x 版,執行時應該會顯示錯誤訊息:

"/Users/your_account/your_path/MaxBot.app/Contents/Resources/undetected_chromedriver/patcher.py", line 4, in from distutils.version import LooseVersion ModuleNotFoundError: No module named 'distutils' 目前使用的第三方元件 undetected_chromedriver 暫時無法在 python 3.12.x 環境下執行, 請手動移掉您 macOS 裡的 python, 並重新下載 python 3.10.x 版。下載用傳送門: https://www.python.org/downloads/

max32002 commented 11 months ago

有好心人提供解法, 目前應該是有相容於 Python 12+, https://github.com/ultrafunkamsterdam/undetected-chromedriver/pull/1641

驗證碼的元件 ddddocr, 目前還是只支援 intel CPU 且在 python 3.10(含) 以下才能運作.