Open JakoDel opened 1 month ago
have you tried this? https://github.com/vxiiduu/VxKex/issues/178#issuecomment-2041401835
have you tried this? #178 (comment)
thanks for the reply! 1.already installed
A couple of weeks ago, I encountered this problem while experimenting with Python 3.11 and VxKex. Basically, when VxKex is activated, Python kind of goes haywire (you can easily verify this by running some commands from the \scripts folder). What's odd is that this issue doesn't happen with Python 3.10. I've attempted to compare logs and process environments from both versions but couldn't identify anything obvious.
As for alternatives like PythonWin7 or api-ms-win-core-path-HACK, I've come to realize that we can't reliably depend on them anymore after testing numerous Python apps this week. The problem is that there are already popular Python libraries or modules that import Win 8+ only APIs.
For example, here's a *.pyd file in the site-packages folder of a project that requires Python 3.11+. It imports two APIs exclusive to Windows 8 and above. VxKex can easily solve these APIs.
Since VxKex is currently incompatible with Python 3.11, I built the project on Python 3.10 (fortunately, it didn't rely on 3.11 features, or perhaps it did—I'm unsure, lol) and activated VxKex, effectively handling the Win 8+ only *.pyd library file.
Unfortunately, these kinds of Python packages will increase over time, just as the number of projects and applications requiring Python 3.11+
If there were a vote for what to prioritize next, I'd definitely cast my ballot for this.
Try this command:
python -s -m ensurepip -U --default-pip
It should install pip.
Try this command:
python -s -m ensurepip -U --default-pip
It should install pip.
In my case, I already have pip, etc., installed previously with the api-ms-win-core-path-l1-1-0 hack.
Python, pip, and all other scripts in the /scripts folder work fine.
However, if I activate VxKex on python.exe (Python311):
I launched cmd from this C:\I\Started\CMDfromHERE folder
VxKex Enabled
VxKex Disabled (using api-ms-win-core-path-l1-1-0.dll)
Definitely VxKex bug, right?
Here's the solution for running Python 3.11 and Python 3.12 under VxKex until a future update resolves the issue.
As seen in the screenshot from the previous post, enabling VxKex causes sys.path
and sys.prefix
initialization to result in incorrect paths.
Under normal conditions, sys.path
should contain:
C:\Users\PC\AppData\Local\Programs\Python\Python312
C:\Users\PC\AppData\Local\Programs\Python\Python312\Python312.zip
C:\Users\PC\AppData\Local\Programs\Python\Python312\DLLs
C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib
C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages
And sys.prefix
should point to the directory of python.exe:
C:\Users\PC\AppData\Local\Programs\Python\Python312
However, with VxKex enabled, Python 3.11+ incorrectly sets sys.path
as:
\\?\C:\Users\PC\AppData\Local\Programs\Python\Python312\Python312
(missing .zip extension)C:\Users\PC\AppData\Local\Programs\Python\Python312\DLLs
C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib
\\?\C:\Users\PC\
(cmd home, should not be here)C:\Users\PC\
(another cmd home, should not be here)And more importantly, following path is not included.
C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages
As for sys.prefix
, It's incorrectly set to:
C:\Users\PC\
(cmd home, should be the directory of python.exe)To fix this, you can use Python's special environment variables to forcefully add the correct paths.
Add the following paths to the PYTHONPATH
environment variable. This forces Python to include these paths in sys.path
:
C:\Users\PC\AppData\Local\Programs\Python\Python312\DLLs
C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib
C:\Users\PC\AppData\Local\Programs\Python\Python312
C:\Users\PC\AppData\Local\Programs\Python\Python312\Python312.zip
C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\site-packages
Set the PYTHONHOME
environment variable to your Python 3.11+ installation directory. This adds the path to sys.prefix
C:\Users\PC\AppData\Local\Programs\Python\Python312
After making these changes, sys.path
and sys.prefix
should look correct:
Now when running Python 3.12, the "Could not find platform independent libraries" error is gone because we added Lib\site-packages
to sys.path
.
However, attempting to install packages with pip results in an error.
Could not import runpy module
Traceback (most recent call last):
File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 14, in <mo
dule>
import importlib.machinery # importlib first so we can test #15386 via -m
File "C:\Users\PC\AppData\Local\Programs\Python\Python312\Lib\importlib\machinery.py", l
ine 15, in <module>
from ._bootstrap_external import NamespaceLoader
ImportError: cannot import name 'NamespaceLoader' from 'importlib._bootstrap_external' (C:
\Users\PC\AppData\Local\Programs\Python\Python312\Lib\importlib\_bootstrap_external.py)
This is a different issue related to the Python installer. To resolve it, use python -m ensurepip to install pip, then rename (or copy) pip3.exe to pip.exe in the Python312\Scripts folder, allowing you to type "pip" instead of "pip3".
C:\Users>python -m ensurepip
Looking in links: c:\Users\PC\AppData\Local\Temp\tmpmvanux2t
Processing c:\users\pc\appdata\local\temp\tmpmvanux2t\pip-24.0-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-24.0
Now try installing packages again:
programs that the python setup installs like pip are unaccessible.
right after executing "python", I also get this: Could not find platform independent libraries
thanks a ton for your work.
edit: not a PATH issue as the Scripts folder is completely empty. on 3.8 pip does appear in the folder.