安装高版本python3.10时出现错误:Fatal Python error: init_fs_encoding: failed to get the Python

因为要跑一个程序,创建python解释器为python3.10的虚拟环境时,出现错误:

conda create -n py_3.10 python=3.10

Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = ‘python’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘/home/user/.conda/envs/DE_10/bin/python’
sys.base_prefix = ‘/home/user/.conda/envs/DE_10’
sys.base_exec_prefix = ‘/home/user/.conda/envs/DE_10’
sys.platlibdir = ‘lib’
sys.executable = ‘/home/user/.conda/envs/DE_10/bin/python’
sys.prefix = ‘/home/user/.conda/envs/DE_10’
sys.exec_prefix = ‘/home/user/.conda/envs/DE_10’
sys.path = [
‘/home/user/.conda/envs/DE_10/lib/python310.zip’,
‘/home/user/.conda/envs/DE_10/lib/python3.10’,
‘/home/user/.conda/envs/DE_10/lib/python3.10/lib-dynload’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ValueError: source code string cannot contain null bytes

虚拟环境没有被创建成功,如果降低了python的版本为3.8是可以安装成功,但是如果非要安装python3.10版本的,可以使用下面的命令行进行创建:conda create -n py_3.10 -c conda-forge -y

上面的错误也可能是因为环境变量的问题(但是经过尝试,没有解决问题。)

你可能感兴趣的:(python,开发语言)