CPython配置问题

发布时间 2023-08-30 22:36:32作者: 李你干嘛

本文为李你干嘛原创,转载请注明出处:CPython配置问题

failed to get the Python codec of the filesystem encoding

在初始化CPython前调用

Py_SetPythonHome(PYTHON_HOME) // PYTHON_HOME为Python.exe所在文件夹路径

使用Embeded Python时无法导入numpy

image

对于Python3.8以下的版本,使用

import sys
sys.path.append(PYTHON_HOME + r'\Library\bin')

对于3.8以上的版本,使用

import os
os.add_dll_directory(PYTHON_HOME + r'\Library\bin')

本文为李你干嘛原创,转载请注明出处:CPython配置问题