编译 Python 3.4 不是复制 pip
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22592686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Compiling Python 3.4 is not copying pip
提问by Rui Lima
I have compiled Python 3.4 from the sources on Linux Mint, but for some reason it is not copying pipto its final compiled folder (after the make install).
我已经从 Linux Mint 上的源代码编译了 Python 3.4,但由于某种原因它没有复制pip到其最终编译的文件夹(在 之后make install)。
Any ideas?
有任何想法吗?
采纳答案by Rui Lima
Just sorted it out. Here it is how to compile python from the sources.
刚整理出来 这是如何从源代码编译python。
$ ./configure --prefix=/home/user/sources/compiled/python3.4_dev --with-ensurepip=install
$ make
$ make install
If you get "Ignoring ensurepip failure: pip 1.5.4 requires SSL/TLS" error:
如果您收到“Ignoring ensurepip failure: pip 1.5.4 requires SSL/TLS”错误:
$ sudo apt-get install libssl-dev openssl
$ ls
2to3 idle3 pip3.5 python3 python3.5m pyvenv
2to3-3.5 idle3.5 pydoc3 python3.5 python3.5m-config pyvenv-3.5
easy_install-3.5 pip3 pydoc3.5 python3.5-config python3-config
As you can see pip is copied into target folder, the --with-ensurepip=installis important.
正如您所看到的 pip 被复制到目标文件夹中,这--with-ensurepip=install很重要。
回答by falsetru
According to PEP 453 -- Explicit bootstraping of pip in Python installation:
根据PEP 453 - Python 安装中 pip 的显式引导:
Installing from source
Just as the prebuilt binary installers will be updated to run python -m ensurepip by default, a similar change will be made to the make install and make altinstall commands of the source distribution. The directory settings in the sysconfig module should ensure the pip components are automatically installed to the expected locations.
从源安装
正如预构建的二进制安装程序将更新为默认运行 python -m ensurepip一样,将对源代码分发的 make install 和 make altinstall 命令进行类似的更改。sysconfig 模块中的目录设置应确保 pip 组件自动安装到预期位置。
After installing from source code, I found that pip3.4is put in the destination. (No pipnor pip3)
从源代码安装后,我发现它pip3.4放在目的地。(没有pip也没有pip3)
回答by Bekzot Asimov
If you are in Redhat linux (centos, fedora) install following package.
如果您使用的是 Redhat linux (centos, fedora),请安装以下软件包。
yum install openssl-devel -y

