无法使用 python3

无法使用 python3

不知不觉中,我删除了(根)目录中的 python 文件夹/,因此当我尝试运行 python3 时出现此错误。

python3.2.3通过手动下载和使用read me文件安装的方式重新安装了版本。仍然面临同样的问题。

next@NEXT-IN-WS010:~$ python3
Traceback (most recent call last):
  File "/usr/local/lib/python3.2/sysconfig.py", line 334, in _init_posix
_parse_makefile(makefile, vars)
  File "/usr/local/lib/python3.2/sysconfig.py", line 220, in _parse_makefile
with open(filename, errors="surrogateescape") as f:
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python3.2/config-3.2mu/Makefile'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.2/site.py", line 529, in <module>
main()
  File "/usr/local/lib/python3.2/site.py", line 517, in main
known_paths = addusersitepackages(known_paths)
  File "/usr/local/lib/python3.2/site.py", line 263, in addusersitepackages
user_site = getusersitepackages()
  File "/usr/local/lib/python3.2/site.py", line 238, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/lib/python3.2/site.py", line 228, in getuserbase
USER_BASE = get_config_var('userbase')
  File "/usr/local/lib/python3.2/sysconfig.py", line 577, in get_config_var
return get_config_vars().get(name)
  File "/usr/local/lib/python3.2/sysconfig.py", line 474, in get_config_vars
_init_posix(_CONFIG_VARS)
  File "/usr/local/lib/python3.2/sysconfig.py", line 339, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/lib/python3.2/config-3.2mu/Makefile (No such file or directory)

有解决办法吗?还是我应该重新安装操作系统

注意:如果可以打开 3.3(或更高版本)而不是 3.2.3,我们将非常欢迎

编辑1:当我尝试使用时sudo apt-get install python3,它说python3已经是最新版本。

答案1

我再次找到了解决方案。

当我通过各种链接寻找时,最终找到了这个关联

只需重新安装该python3版本并输入hash -r以下命令即可恢复该版本。

cd "to the directory where downloaded python is"
./configure
make
make test
sudo make install
hash -r

相关内容