Python 编译

解压:

tar -zxf PythonXX.tgz

安装依赖:

yum install libffi-devel

configure

mkdir build
cd build 
../configure --enable-optimizations --prefix=`pwd`/install --with-openssl=$OPEN_SSL_INSTALL_DIR

其他可选的config:

--enable-shared --with-shared

Build:

make -j 48
make install

然后可以把install打包.
注意,install之后pip里面的value是指向绝对路径的。如果直接用pip install 他会装到之前 prefix/install 的路径的

所以一般的建议用pip之前是修改PYTHONPATH https://docs.python.org/3/using/cmdline.html#environment-variables

export PYTHONPATH=/root/python38
./bin/python3 ./bin/pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple grpcio
posted @ 2020-09-28 15:53  stdpain  阅读(130)  评论(0编辑  收藏  举报