今天在安装Redis和Python上遇到了些问题,解决后记录下来。python
环境:LinuxMint 18.3redis
sudo wget http://download.redis.io/releases/redis-4.0.8.tar.gz sudo tar -zxf redis-4.0.8.tar.gz -C /usr/redis/ cd /usr/redis/redis-4.0.8 sudo make
个人安装目录是/usr/redis。shell
在make的过程当中遇到了下列问题:python2.7
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解决:.net
sudo apt-get install libc6-dev
参考:http://blog.csdn.net/yygydjkthh/article/details/41787049code
zmalloc.h:50:31: fatal error: jemalloc/jemalloc.h: No such file or directory
缘由是libc不是默认的分配器,在make后添加参数解决:blog
sudo make MALLOC=libc
参考:http://blog.csdn.net/fygkchina/article/details/51006976get
Mint 18.3中内置了python的两个版本:2.7和3.5,当使用python命令时默认使用2.7,因我的需求要使用3,找到一个比较好的不用删除python2的方法:it
注意:只适用于Debian系的Linuxio
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 9 sudo 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 --version Python 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 手动模式 要维持当前值[*]请按<回车键>,或者键入选择的编号:1 update-alternatives: 使用 /usr/bin/python2.7 来在手动模式中提供 /usr/bin/python (python) $ python --version Python 2.7.12
更多解决方案:http://blog.csdn.net/justdoithai/article/details/70310095