您好,我刚刚安装了 python,如下所示,altinstall 出现错误,我应该使用 make install 吗?
./configure
make
sudo make altinstall
或者
./configure
make
sudo make install
我正在按照教程操作,但出现了这个错误。
File "/home/plutes/Downloads/Python-3.6.6rc1/Lib/ensurepip/__init__.py", line 117, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/home/plutes/Downloads/Python-3.6.6rc1/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip._internal
**zipimport.ZipImportError: can't decompress data; zlib not available
Makefile:1113: recipe for target 'altinstall' failed
make: *** [altinstall] Error 1**
plutes@plutes-Lenovo-G50-30:~/Downloads/Python-3.6.6rc1$ cd
plutes@plutes-Lenovo-G50-30:~$ python
python python3 python3.6m-config python3m
python2 python3.6 python3.7
python2.7 python3.6m python3.7m
plutes@plutes-Lenovo-G50-30:~$ python3.6
Python 3.6.6rc1 (default, Jun 17 2018, 21:36:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help()
Welcome to Python 3.6's help utility!
as you can see it works, but I am unsure about future uses. thanks for any guidance.
plutes@plutes-Lenovo-G50-30:~$ python3.6
Python 3.6.6rc1 (default, Jun 17 2018, 21:36:49)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello, World!")
Hello, World!
>>>
答案1
python3.7.3
我刚刚在上安装时遇到了同样的问题ubuntu18.04
。以下这条信息并运行:
sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev \
zlib1g-dev libssl-dev openssl libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev \
libncursesw5-dev libffi-dev uuid-dev
让我成功运行sudo make altinstall
。
答案2
我在使用 Ubuntu 时遇到了同样的问题,上面的两个答案都不起作用。我使用了来自https://github.com/pyenv/pyenv/wiki/common-build-problems并再次尝试并且成功了。基本上我做的是:
sudo apt-get install -y make build-essential 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 python-openssl git
进而:
sudo make altinstall
答案3
按此顺序使用以下命令:
./configure
make clean
make
sudo make install
答案4
安装以下依赖项将解决该问题:
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev
libssl-dev libreadline-dev libffi-dev wget