python3環境安裝

mingtian是吧發表於2024-06-05

安裝python3.6(更高版本對openssl版本有要求centos7可能build失敗)

curl -q# https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz -o Python-3.6.9.tar.xz 
tar xf Python-3.6.9.tar.xz 
cd Python-3.6.9/
./configure --prefix=/opt/python3.6
make -j 4 && make install 

echo "export PATH=/opt/python3.6/bin:\$PATH">>/etc/profile

source /etc/profile

虛擬環境設定

mkdir ~/.pip
echo "[ global ]" >~/.pip/pip.conf
echo "index-url = https://mirrors.aliyun.com/pypi/simple/" >>~/.pip/pip.conf

建立虛擬環境

pip3 install virtualenv

python3 -m venv /opt/py3
source /opt/py3/bin/activate 
# 退出虛擬環境
deactivate

相關文章