1.安装
到官网下载python安装包
https://www.python.org/downloads/source/
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
xz -d Python-3.6.1.tar.xz
tar -xvf Python-3.6.1.tar
cd Python-3.6.1
./configure
make
sudo make install
报错~错误解决办法~
File"/home/lanhaixuan/Python-3.6.1/Lib/runpy.py", line 193, in_run_module_as_main
"__main__",mod_spec)
File"/home/lanhaixuan/Python-3.6.1/Lib/runpy.py", line 85, in_run_code
exec(code,run_globals)
File"/home/lanhaixuan/Python-3.6.1/Lib/ensurepip/__main__.py",line 4, in
ensurepip._main()
File"/home/lanhaixuan/Python-3.6.1/Lib/ensurepip/__init__.py",line 189, in _main
default_pip=args.default_pip,
File"/home/lanhaixuan/Python-3.6.1/Lib/ensurepip/__init__.py",line 102, in bootstrap
_run_pip(args +[p[0] for p in _PROJECTS], additional_paths)
File"/home/lanhaixuan/Python-3.6.1/Lib/ensurepip/__init__.py",line 27, in _run_pip
import pip
zipimport.ZipImportError:can't decompress data; zlib not available
Makefile:1064:recipe for target 'install' failed
make: *** [install]Error 1
解决方式
apt-get install zlib1g-dev
然后重新安装
测试:
python3.6 --version
查看安装位置
whereis python3.6