阿里云服务器问题
今天买了阿里云服务器的云翼计划的学生服务器,配置据说是入门级的,对于我这种新手来说都是差不多的了,遇到一些问题:
CentOS7使用Yum源安装Python3.6
IUS软件源中包含了Python3.6,可以使用IUS软件源安装Python3.6
1)安装IUS软件源
1 #安装EPEL依赖 2 sudo yum install epel-release 3 4 #安装IUS软件源 5 sudo yum install https://centos7.iuscommunity.org/ius-release.rpm
2)安装Python3.6
1 sudo yum install python36u
安装Python3完成后的shell命令为python3.6,为了使用方便,创建一个到python3的符号链接
1 sudo ln -s /bin/python3.6 /bin/python3
3)安装pip3
安装完成python36u并没有安装pip,安装pip
1 sudo yum install python36u-pip
安装pip完成后的shell命令为pip3.6,为了使用方便,创建一个到pip3的符号链接
sudo ln -s /bin/pip3.6 /bin/pip3
使用上述方法创建的符号链接来安装模块的时候出现问题
1 #include "Python.h" 2 ^ 3 compilation terminated. 4 error: command 'gcc' failed with exit status 1 5 6 ---------------------------------------- 7 Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-9igalvkz/Twisted/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-tesv2pzh/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-9igalvkz/Twisted/
解决方案:
1 yum search python3 | grep devel
1 [root@iZ2zebg8yn9qw8bqhc9isxZ ~]# yum search python3 | grep devel 2 python34-cairo-devel.x86_64 : Libraries and headers for python34-cairo 3 python34-greenlet-devel.x86_64 : C development headers for python34-greenlet 4 python34-devel.x86_64 : Libraries and header files needed for Python 3 5 : development 6 python34-gobject-devel.x86_64 : Development files for embedding Python 3.4 7 python34u-devel.x86_64 : Libraries and header files needed for Python 3 8 : development 9 python35u-devel.x86_64 : Libraries and header files needed for Python 3 10 : development 11 python36-devel.x86_64 : Libraries and header files needed for Python development 12 python36-idle.x86_64 : A basic graphical development environment for Python 13 python36u-devel.x86_64 : Libraries and header files needed for Python 14 : development 15 shiboken-python34-devel.x86_64 : Development files for shiboken
找到 python36u-devel 执行:
1 sudo yum install python36u-devel
执行完毕之后,再次执行安装指令:
1 pip3 install scrapy
执行成功,安装完毕。