gpt4 book ai didi

python - 使用 pyenv 安装 python 3.8 时出现问题

转载 作者:行者123 更新时间:2023-12-04 18:26:51 42 4
gpt4 key购买 nike

我尝试使用命令 pyenv install 3.8.11 安装 python
如果您需要更多信息,请告诉我。谢谢你的关注。
输出:

BUILD FAILED (Ubuntu 20.04 using python-build 20180424)

Inspect or clean up the working tree at /tmp/python-build.20210821132713.23441
Results logged to /tmp/python-build.20210821132713.23441.log

Last 10 log lines:
File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/ensurepip/__init__.py", line 206, in _main
return _bootstrap(
File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/ensurepip/__init__.py", line 125, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/ensurepip/__init__.py", line 34, in _run_pip
return subprocess.run([sys.executable, "-c", code], check=True).returncode
File "/tmp/python-build.20210821132713.23441/Python-3.8.11/Lib/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20210821132713.23441/Python-3.8.11/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmp7l0fqi9l/setuptools-56.0.0-py3-none-any.whl\', \'/tmp/tmp7l0fqi9l/pip-21.1.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmp7l0fqi9l\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1198: install] Error 1
日志:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 203, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
Traceback (most recent call last):
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__init__.py", line 206, in _main
return _bootstrap(
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__init__.py", line 125, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/ensurepip/__init__.py", line 34, in _run_pip
return subprocess.run([sys.executable, "-c", code], check=True).returncode
File "/tmp/python-build.20210821140419.301/Python-3.8.11/Lib/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/python-build.20210821140419.301/Python-3.8.11/python', '-c', '\nimport runpy\nimport sys\nsys.path = [\'/tmp/tmp1imhbulh/setuptools-56.0.0-py3-none-any.whl\', \'/tmp/tmp1imhbulh/pip-21.1.1-py3-none-any.whl\'] + sys.path\nsys.argv[1:] = [\'install\', \'--no-cache-dir\', \'--no-index\', \'--find-links\', \'/tmp/tmp1imhbulh\', \'--root\', \'/\', \'--upgrade\', \'setuptools\', \'pip\']\nrunpy.run_module("pip", run_name="__main__", alter_sys=True)\n']' returned non-zero exit status 1.
make: *** [Makefile:1198: install] Error 1

最佳答案

pyenv需要一些包来从源代码构建 Python。
对于 Ubuntu,来自 pyenv wiki: suggested build environment

sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

关于python - 使用 pyenv 安装 python 3.8 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68876560/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com