下載地址:https://www.anaconda.com/distribution/#download-sectionpython
#安裝腳本 [root@app1 local]# ls -lh Anaconda3-2018.12-Linux-x86_64.sh -rw-r--r-- 1 root root 653M Mar 5 15:55 Anaconda3-2018.12-Linux-x86_64.sh #安裝後的目錄 [root@app1 local]# ll -h /data/anaconda3/ total 208K drwxr-xr-x 4 root root 12K Mar 5 18:39 bin drwxr-xr-x 2 root root 4.0K Mar 5 16:21 compiler_compat drwxr-xr-x 2 root root 20K Mar 5 16:23 conda-meta drwxr-xr-x 3 root root 4.0K Mar 5 16:22 doc drwxr-xr-x 2 root root 4.0K Mar 5 16:23 envs drwxr-xr-x 7 root root 4.0K Mar 5 16:23 etc drwxr-xr-x 38 root root 12K Mar 5 16:23 include drwxr-xr-x 23 root root 36K Mar 5 16:23 lib drwxr-xr-x 4 root root 4.0K Mar 5 16:22 libexec -rw-r--r-- 1 root root 5.7K Dec 20 13:45 LICENSE.txt drwxr-xr-x 3 root root 4.0K Mar 5 16:21 man drwxr-xr-x 65 root root 4.0K Mar 5 16:22 mkspecs drwxr-xr-x 2 root root 4.0K Mar 5 16:22 phrasebooks drwxr-xr-x 278 root root 36K Mar 5 16:20 pkgs drwxr-xr-x 26 root root 4.0K Mar 5 16:22 plugins drwxr-xr-x 25 root root 4.0K Mar 5 16:22 qml drwxr-xr-x 2 root root 4.0K Mar 5 16:22 resources drwxr-xr-x 2 root root 4.0K Mar 5 16:22 sbin drwxr-xr-x 31 root root 4.0K Mar 5 16:23 share drwxr-xr-x 3 root root 4.0K Mar 6 08:32 ssl drwxr-xr-x 3 root root 12K Mar 5 16:22 translations drwxr-xr-x 3 root root 4.0K Mar 5 16:22 var -rw-r--r-- 1 root root 0 Mar 5 16:31 vscode_inst.py.log drwxr-xr-x 3 root root 4.0K Mar 5 16:21 x86_64-conda_cos6-linux-gnu #啓動jupyter /data/anaconda3/bin/jupyter notebook --ip=0.0.0.0 --port=8889 --allow-root --no-browser
編譯前的準備 yum -y install zlib* #解決編譯zip報錯 yum -y install readline-devel #解決python3沒法使用ctrl+l清屏問題 yum -y install openssl-devel #解決安裝後pip3沒法使用ssl的問題 yum -y install libffi-devel #解決沒法編譯_ctypes模塊問題
#系統原本的openssl包,這個版本已不被Python3.7支持,直接編譯沒法經過 [root@app1 local]# yum list installed | grep openssl openssl.x86_64 1.0.1e-57.el6 @base openssl-devel.x86_64 1.0.1e-57.el6 @base
下載地址:https://www.openssl.org/source/linux
[root@app1 local]# ls -lh openssl-1.0.2r.tar.gz -rw-r--r-- 1 root root 5.2M Mar 5 20:57 openssl-1.0.2r.tar.gz ./config make make test make install #本次安裝在這個目錄 [root@app1 local]# ls -lh /usr/local/ssl total 52K drwxr-xr-x 2 root root 4.0K Mar 6 08:02 bin drwxr-xr-x 2 root root 4.0K Mar 5 19:03 certs drwxr-xr-x 3 root root 4.0K Mar 6 08:02 include drwxr-xr-x 4 root root 4.0K Mar 6 08:34 lib drwxr-xr-x 6 root root 4.0K Mar 6 08:01 man drwxr-xr-x 2 root root 4.0K Mar 6 08:02 misc -rw-r--r-- 1 root root 11K Mar 6 08:02 openssl.cnf -rw-r--r-- 1 root root 11K Mar 5 19:03 openssl.cnf.dist drwxr-xr-x 2 root root 4.0K Mar 5 19:03 private
#編譯前準備 vim /usr/local/Python-3.7.2/Modules/Setup #修改編譯時的ssl配置 SSL=/usr/local/ssl #openssl安裝目錄 _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto
#配置、編譯、安裝 ./configure --prefix=/usr/local/ --with-openssl=/usr/local/ssl/ make make install
pip3 install --upgrade pip pip3 install jupyter
jupyter notebook --ip=0.0.0.0 --allow-root --no-browser
此時若是報錯沒法導入sqlite3,確保系統安裝了sqlite,沒有的話須要安裝,而後從新編譯Python3.7git
[root@app1 ~]# yum list installed | grep sqlite qt-sqlite.x86_64 1:4.6.2-26.el6_4 @anaconda-CentOS-201311272149.x86_64/6.5 sqlite.x86_64 3.6.20-1.el6_7.2 @base sqlite-devel.x86_64 3.6.20-1.el6_7.2 @base
[root@app1 ~]# pip3 uninstall tornado Uninstalling tornado-6.0.1: Would remove: /usr/local/lib/python3.7/site-packages/tornado-6.0.1-py3.7.egg-info /usr/local/lib/python3.7/site-packages/tornado/* Proceed (y/n)? y Successfully uninstalled tornado-6.0.1 [root@app1 ~]# pip3 install tornado==5.1.1 Collecting tornado==5.1.1 Downloading https://files.pythonhosted.org/packages/e6/78/6e7b5af12c12bdf38ca9bfe863fcaf53dc10430a312d0324e76c1e5ca426/tornado-5.1.1.tar.gz (516kB) 100% |████████████████████████████████| 522kB 10.0MB/s Installing collected packages: tornado Running setup.py install for tornado ... done Successfully installed tornado-5.1.1