阿里雲服務器問題

今天買了阿里雲服務器的雲翼計劃的學生服務器,配置聽說是入門級的,對於我這種新手來講都是差很少的了,遇到一些問題:python

CentOS7使用Yum源安裝Python3.6

IUS軟件源中包含了Python3.6,能夠使用IUS軟件源安裝Python3.6shell

1)安裝IUS軟件源centos

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的符號連接scrapy

1 sudo ln -s /bin/python3.6 /bin/python3

3)安裝pip3阿里雲

安裝完成python36u並無安裝pip,安裝pipcentos7

1 sudo yum install python36u-pip

安裝pip完成後的shell命令爲pip3.6,爲了使用方便,建立一個到pip3的符號連接spa

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/

解決方案:code

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 執行:blog

1 sudo yum install python36u-devel

執行完畢以後,再次執行安裝指令:

1 pip3 install scrapy

執行成功,安裝完畢。

相關文章
相關標籤/搜索