WSL2(ubuntu22.04)で asdf install python をすると下記のエラーになりました。
$ asdf install python 3.9.16 python-build 3.9.16 /home/blue21/.asdf/installs/python/3.9.16 Downloading Python-3.9.16.tar.xz... -> https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tar.xz Installing Python-3.9.16... Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/blue21/.asdf/installs/python/3.9.16/lib/python3.9/ssl.py", line 99, in <module> import _ssl # if we can't import it, let the error propagate ModuleNotFoundError: No module named '_ssl' ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? Please consult to the Wiki page to fix the problem. https://github.com/pyenv/pyenv/wiki/Common-build-problems BUILD FAILED (Ubuntu 22.04 using python-build 2.3.17-9-g528d10e9) Inspect or clean up the working tree at /tmp/python-build.20230508095140.208920 Results logged to /tmp/python-build.20230508095140.208920.log Last 10 log lines: LD_LIBRARY_PATH=/tmp/python-build.20230508095140.208920/Python-3.9.16 ./python -E -m ensurepip \ $ensurepip --root=/ ; \ fi Looking in links: /tmp/tmpecek77jj Processing /tmp/tmpecek77jj/setuptools-58.1.0-py3-none-any.whl Processing /tmp/tmpecek77jj/pip-22.0.4-py3-none-any.whl Installing collected packages: setuptools, pip WARNING: The scripts pip3 and pip3.9 are installed in '/home/blue21/.asdf/installs/python/3.9.16/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-22.0.4 setuptools-58.1.0
下記URLを参考に依存パッケージはインストール済です。
brew を使ってる影響だろうか?
ネットで調べて、いろいろ試しましたが、下記のようにしたらinstallに成功しました。
$ PYTHON_CONFIGURE_OPTS="--with-openssl=/usr --with-openssl-rpath=/usr/lib64 --enable-optimizations" asdf install python 3.9.16 python-build 3.9.16 /home/blue21/.asdf/installs/python/3.9.16 Downloading Python-3.9.16.tar.xz... -> https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tar.xz Installing Python-3.9.16... Installed Python-3.9.16 to /home/blue21/.asdf/installs/python/3.9.16
list で見ると以下のとおり。
$ asdf list python *3.11.3 3.9.16