dotfiles/python/install.sh

31 lines
772 B
Bash
Raw Normal View History

2020-11-02 04:08:18 +00:00
#!/bin/sh
2020-09-17 10:24:35 +00:00
2020-11-02 04:08:18 +00:00
DIR=$(readlink -f "$(dirname "$0")")
. "$DIR/../env.sh"
2020-09-17 10:24:35 +00:00
2020-09-18 04:16:15 +00:00
# config pip mirror for CHINA
2020-11-02 04:08:18 +00:00
if in_china; then
lnsf "$DIR/pip.conf" ~/.pip/pip.conf
2020-09-18 04:16:15 +00:00
if sudo [ ! -f /root/.pip/pip.conf ]; then
sudo mkdir -p /root/.pip
2020-11-02 04:08:18 +00:00
sudo cp "$DIR/pip.conf" /root/.pip/pip.conf
2020-09-18 04:16:15 +00:00
fi
fi
2020-09-17 10:24:35 +00:00
# install python3
case "$PM" in
apt)
sudo apt install python3 python3-pip python-is-python3
2020-11-02 04:08:18 +00:00
command -v fish 2>/dev/null && sudo pip3 install virtualfish
2020-09-17 10:24:35 +00:00
;;
pacman)
2020-09-18 18:01:58 +00:00
sudo pacman -S --needed python python-pip
2020-11-02 04:08:18 +00:00
command -v fish 2>/dev/null && sudo pip install virtualfish
2020-09-17 10:24:35 +00:00
;;
esac
2020-09-17 16:02:24 +00:00
# enable auto_activation plugin for virtualfish
2020-11-02 04:08:18 +00:00
command -v fish 2>/dev/null && fish -c "yes | vf install && vf addplugins auto_activation"
2020-09-17 16:02:24 +00:00