Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu Python3输入()错误:can';t初始化系统标准流_Ubuntu_Python 3.x - Fatal编程技术网

Ubuntu Python3输入()错误:can';t初始化系统标准流

Ubuntu Python3输入()错误:can';t初始化系统标准流,ubuntu,python-3.x,Ubuntu,Python 3.x,我在Ubuntu 15.04上运行Python 3.4.3,在尝试使用input()函数时遇到了一个非常奇怪的问题 为了隔离问题,Iv'e创建了一个名为test.py contaning的文件: print(input()) 运行时,我收到以下错误: $ python3 test.py Fatal Python error: Py_Initialize: can't initialize sys standard streams ImportError: bad magic number in

我在Ubuntu 15.04上运行Python 3.4.3,在尝试使用
input()
函数时遇到了一个非常奇怪的问题

为了隔离问题,Iv'e创建了一个名为test.py contaning的文件:

print(input())
运行时,我收到以下错误:

$ python3 test.py
Fatal Python error: Py_Initialize: can't initialize sys standard streams
ImportError: bad magic number in 'io': b'\x03\xf3\r\n'
[1]    8599 abort (core dumped)  python3 test.py

有人知道发生了什么吗?

幻数是指可执行文件的前两个字节。它用于确定如何加载可执行文件

幻数也用于从
*.py
文件编译的
*.py
文件中。它说明了内部使用的字节码版本

在您的例子中,现在似乎有了更新的Python,并且有一些来自旧版本的
*.pyc
文件。这应该在安装过程中解决,但可能没有

只需搜索
*.pyc
文件并将其删除即可。它们将自动创建。

可能的副本