Ubuntu20.04 编译安装 CPython3.10.8(WSL2)
CPython,由C编写的python发行版,通过在github下载源代码,通过cmake进行打包安装
1. ubuntu安装编译工具:
sudo apt-get install libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev libgdbm-dev libgdbm-compat-dev --fix-missingx
2. 下载cpython3.10.8,在github选择v3.10.8版本,然后下载zip
cd /mnt/e/Code/AgithubProject/cpython-3.10.8
3. 编译
./configure
make
make test
# sudo make install 可以不用安装
4. 运行
./python.exe
# Python 3.10.8 (main, Dec 5 2022, 14:44:45) [GCC 9.4.0] on linux
# Type "help", "copyright", "credits" or "license" for more information.
通过vs code 远程连到wsl进行调试运行、学习。