我认为用一系列的提示来描述我的问题是最好的。 我错过了一些东西,不知道是什么? python3.13如何加载python 3.11库???
删除其他版本之类的解决方案并不好。我想按原样修复它。
C:\Temp\2025\01\python_ver_check (master) >where python
C:\Program Files\Python313\python.exe
C:\Program Files\Python311\python.exe
C:\OSGeo4W\bin\python.exe
C:\Users\UserName\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Temp\2025\01\python_ver_check (master) >python --version
Python 3.13.1
C:\Temp\2025\01\python_ver_check (master) >type globaj.py
import glob
for g in glob.glob('*'):
print(g)
C:\Temp\2025\01\python_ver_check (master) >globaj.py
Traceback (most recent call last):
File "C:\Temp\2025\01\python_ver_check\globaj.py", line 1, in <module>
import glob
File "C:\Program Files\Python313\Lib\glob.py", line 5, in <module>
import re
File "C:\Program Files\Python313\Lib\re\__init__.py", line 126, in <module>
from . import _compiler, _parser
File "C:\Program Files\Python313\Lib\re\_compiler.py", line 18, in <module>
assert _sre.MAGIC == MAGIC, "SRE module mismatch"
^^^^^^^^^^^^^^^^^^^
AssertionError: SRE module mismatch
C:\Temp\2025\01\python_ver_check (master) >python globaj.py
globaj.py
net48
net8
C:\Temp\2025\01\python_ver_check (master) >assoc .py
.py=Python.File
C:\Temp\2025\01\python_ver_check (master) >ftype Python.File
Python.File="C:\WINDOWS\py.exe" "%L" %*
C:\Temp\2025\01\python_ver_check (master) >py --version
Python 3.13.1
C:\Temp\2025\01\python_ver_check (master) >echo %PATH%
C:\Program Files\Python313\Scripts\;C:\Program Files\Python313\;C:\Program Files (x86)\Common Files\Oracle\Java\java8path;...
PYTHONHOME
很糟糕!从来不知道这个变量也被使用,只看了PATH
echo %PYTHONHOME%
C:\Program Files\Python311
仍然不确定为什么
python globaj.py
有效,而 globay.py
单独不起作用。