当我尝试使用 pyenv 安装 python 版本时,出现以下错误:
$ pyenv install 3.5.7
Downloading Python-3.5.7.tar.xz...
-> https://www.python.org/ftp/python/3.5.7/Python-3.5.7.tar.xz
Installing Python-3.5.7...
BUILD FAILED (CentOS release 6.10 (Final) using python-build 1.2.13)
Inspect or clean up the working tree at /tmp/python-build.20190726132219.7116
Results logged to /tmp/python-build.20190726132219.7116.log
Last 10 log lines:
File "/tmp/python-build.20190726132219.7116/Python-3.5.7/Lib/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/tmp/python-build.20190726132219.7116/Python-3.5.7/Lib/ensurepip/__init__.py", line 5, in <module>
import tempfile
File "/tmp/python-build.20190726132219.7116/Python-3.5.7/Lib/tempfile.py", line 45, in <module>
from random import Random as _Random
File "/tmp/python-build.20190726132219.7116/Python-3.5.7/Lib/random.py", line 41, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: No module named 'math'
make: *** [Makefile:1048: install] Error 1
Run Code Online (Sandbox Code Playgroud)
尝试使用 python 3.5.7 / 3.6.9 / 3.7.4
我的 python 系统版本指向 anaconda 二进制文件而不是 anaconda /usr/bin/python,卸载 anaconda对我有用。
注意我还必须将其从 $PATH 中删除,然后重新启动 shell,否则安装程序会在现已删除的 anaconda 目录中查找 gcc
| 归档时间: |
|
| 查看次数: |
1361 次 |
| 最近记录: |