Fork me on GitHub

linux下安装python3.6

这是崔斯特的第四十四篇原创文章

linux操作 (๑• . •๑)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sudo sed -i 's\archive.ubuntu.com\mirrors.aliyun.com\g' /etc/apt/sources.list
sudo apt-get update
cd /home/
sudo apt-get install gcc make zlib1g-dev -y
sudo apt-get install libbz2-dev libsqlite3-dev libxml2-dev libffi-dev libssl-dev -y
sudo apt install wget -y
wget http://mirrors.sohu.com/python/3.6.2/Python-3.6.2.tgz # 可以换成你想要的版本
tar -xvf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/home/usr/python36/
sudo make
sudo make install
cd ../usr/python36/bin/
sudo mkdir -p ~/.pip/
sudo cat << EOF > ~/.pip/pip.conf
[global]
trusted-host=mirrors.aliyun.com
index-url=http://mirrors.aliyun.com/pypi/simple/
EOF
sudo apt-get install libmysqlclient-dev -y
ln -s /home/usr/python36/bin/pip3 /usr/bin/pip36
ln -s /home/usr/python36/bin/python3 /usr/bin/python36

以后就可以使用 pip36 python36来进行操作。

如果在命令行中输入scrapy提示没这个命令,可以试试python36 -m scrapy