cztomczak / cefpython

Python bindings for the Chromium Embedded Framework (CEF)
Other
3.03k stars 469 forks source link

Python version not supported: 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] #624

Open thanhvodad opened 2 years ago

thanhvodad commented 2 years ago

Questions should be asked on the forum: https://groups.google.com/group/cefpython

cztomczak commented 2 years ago

What do you mean? Are you using CEF python v66.1?

thanhvodad commented 2 years ago

Yes I'm on v66.1, Give me a reasonable version, I'm learning :(

cztomczak commented 2 years ago

What exactly is your issue?

thanhvodad commented 2 years ago

I can't run on python 9, it says not supported, as title tiêu

cztomczak commented 2 years ago

You need to provide more details of what is happening. It works fine for me with Python 3.9.

thanhvodad commented 2 years ago

Traceback (most recent call last): File "C:\Users\xPrivate\Desktop\PyThon\cztomczak\main.py", line 4, in from cefpython3 import cefpython as cef File "C:\Users\xPrivate\AppData\Local\Programs\Python\Python39\lib\site-packages\cefpython3__init__.py", line 64, in raise Exception("Python version not supported: " + sys.version) Exception: Python version not supported: 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]

Process finished with exit code 1

cztomczak commented 2 years ago

Looks like there is something wrong with your CEF Python installation. Uninstall it. Go to lib/site-packages/ and delete any cefpython3* files/directories. Then install it again.

On my computer I have c:\Pythons\Python39\Lib\site-packages\cefpython3\__init__.py file and there is the code that loads the cefpython module:

# Load the cefpython module for given Python version
if sys.version_info[:2] == (2, 7):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py27 as cefpython
elif sys.version_info[:2] == (3, 4):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py34 as cefpython
elif sys.version_info[:2] == (3, 5):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py35 as cefpython
elif sys.version_info[:2] == (3, 6):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py36 as cefpython
elif sys.version_info[:2] == (3, 7):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py37 as cefpython
elif sys.version_info[:2] == (3, 8):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py38 as cefpython
elif sys.version_info[:2] == (3, 9):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py39 as cefpython
else:
    raise Exception("Python version not supported: " + sys.version)

In yours case the file with this code is in a different location, I don't know why. Looks to me the code that executes for you is from an older version of cefpython. Not v66.1.

zozitak commented 2 years ago

pip install cefpython3 >

# Copyright (c) 2013 CEF Python, see the Authors file.
# All rights reserved. Licensed under BSD 3-clause license.
# Project website: https://github.com/cztomczak/cefpython

# NOTE: Template variables like 66.0 are replaced with actual
#       values when make_installer.py tool generates this package
#       installer.

import os
import sys
import ctypes
import platform

__all__ = ["cefpython"]  # Disabled: "wx"
__version__ = "66.0"
__author__ = "The CEF Python authors"

# If package was installed using PIP or setup.py then package
# dir is here:
#   /usr/local/lib/python2.7/dist-packages/cefpython3/

# If this is a debian package then package_dir returns:
#   /usr/lib/pymodules/python2.7/cefpython3
# The above path consists of symbolic links to the real directory:
#   /usr/share/pyshared/cefpython3

package_dir = os.path.dirname(os.path.abspath(__file__))

# This loads the libcef.so library for the subprocess executable.
# On Mac it works without setting library paths.
os.environ["LD_LIBRARY_PATH"] = package_dir

# This env variable will be returned by cefpython.GetModuleDirectory().
os.environ["CEFPYTHON3_PATH"] = package_dir

# This loads the libcef library for the main python executable.
# Loading library dynamically using ctypes.CDLL is required on Linux.
# TODO: Check if on Linux libcef.so can be linked like on Mac.
# On Mac the CEF framework dependency information is added to
# the cefpython*.so module by linking to CEF framework.
# The libffmpegsumo.so library does not need to be loaded here,
# it may cause issues to load it here in the browser process.
if platform.system() == "Linux":
    libcef = os.path.join(package_dir, "libcef.so")
    ctypes.CDLL(libcef, ctypes.RTLD_GLOBAL)

# Load the cefpython module for given Python version
if sys.version_info[:2] == (2, 7):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py27 as cefpython
elif sys.version_info[:2] == (3, 4):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py34 as cefpython
elif sys.version_info[:2] == (3, 5):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py35 as cefpython
elif sys.version_info[:2] == (3, 6):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py36 as cefpython
elif sys.version_info[:2] == (3, 7):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py37 as cefpython
else:
    raise Exception("Python version not supported: " + sys.version)

i miss my

elif sys.version_info[:2] == (3, 8):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py38 as cefpython
elif sys.version_info[:2] == (3, 9):
    # noinspection PyUnresolvedReferences
    from . import cefpython_py39 as cefpython

part