LinuxMint上安裝redis和python遇到的一些問題

來源:互聯網
上載者:User

標籤:pos   手動   3.5   安裝redis   python版本   ref   tar.gz   dev   adl   

今天在安裝Redis和Python上遇到了些問題,解決後記錄下來。

環境:LinuxMint 18.3

安裝redis
sudo wget http://download.redis.io/releases/redis-4.0.8.tar.gzsudo tar -zxf redis-4.0.8.tar.gz -C /usr/redis/cd /usr/redis/redis-4.0.8sudo make

我的安裝目錄是/usr/redis。

在make的過程中遇到了下列問題:

net.c:36:23: fatal error: sys/types.h: No such file or directory...adlist.c:32:20: fatal error: stdlib.h: No such file or directory

原因是缺少檔案,執行以下命令後再次make解決:

sudo apt-get install libc6-dev

參考:http://blog.csdn.net/yygydjkthh/article/details/41787049

zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory

原因是libc不是預設的分配器,在make後添加參數解決:

sudo make MALLOC=libc

參考:http://blog.csdn.net/fygkchina/article/details/51006976

Python版本切換

Mint 18.3中內建了python的兩個版本:2.7和3.5,當使用python命令時預設使用2.7,因個人需求要使用3,找到一個比較好的不用刪除python2的方法:

注意:只適用於Debian系的Linux

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 9sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 10

/usr/bin/python2.7和/usr/bin/python3.5是本地python的安裝目錄,後面的9和10是優先順序,如果優先使用3則將優先順序設為比2高的數值即可。

再次查看python版本

python --versionPython 3.5.2

注意:只適用於Debian系的Linux

如果要切換回2也很簡單,執行命令

sudo update-alternatives --config python

後選擇相應的選項即可切換成功

$ sudo update-alternatives --config python有 2 個候選項可用於替換 python (提供 /usr/bin/python)。  選擇       路徑              優先順序  狀態------------------------------------------------------------* 0            /usr/bin/python3.5   10        自動模式  1            /usr/bin/python2.7   9         手動模式  2            /usr/bin/python3.5   10        手動模式要維持當前值[*]請按<斷行符號鍵>,或者鍵入選擇的編號:1update-alternatives: 使用 /usr/bin/python2.7 來在手動模式中提供 /usr/bin/python (python)$ python --versionPython 2.7.12

更多解決方案:http://blog.csdn.net/justdoithai/article/details/70310095

LinuxMint上安裝redis和python遇到的一些問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.