为什么80%的码农都做不了架构师?>>>
1、一些Python包安装
[root@v6i6v ~]# pip install virtualenv
[root@v6i6v v6i6v]# pwd
/home/v6i6v
使用虚拟环境,注意在新建虚拟环境时,可以选择是否使虚拟环境读取系统python的包。
若不读取系统python的包则如下:
[root@v6i6v v6i6v]# virtualenv venv-django --no-site-packages
New python executable in /home/v6i6v/venv-django/bin/python
Installing setuptools, pip, wheel...done.
若读取系统python的包则如下:
[root@v6i6v v6i6v]# virtualenv venv-django
New python executable in /home/v6i6v/venv-django/bin/python
Installing setuptools, pip, wheel...done.
虚拟环境的几个命令:
激活:source venv-django/bin/activate
停用:deactivate
2、Django安装
激活虚拟环境并安装django
[root@v6i6v v6i6v]# source venv-django/bin/activate
(venv-django) [root@v6i6v v6i6v]# pip install django
3、蛋疼的事,真折腾唉
没去查python2.7.11需不需要安装python-devel。反正去安装的话,蛋疼的屁事一堆,如下:
安装python-devel报错
[root@v6i6v]# yum install python-devel
Traceback (most recent call last):
File "/usr/libexec/urlgrabber-ext-down", line 22, in
from urlgrabber.grabber import \
ImportError: No module named urlgrabber.grabber
解决办法:
把系统自带python种的urlgrabber文件夹复制到新安装的site-packages目录下
[root@v6i6v]# cp -rf /usr/lib/python2.7/site-packages/urlgrabber /opt/python27/lib/python2.7/site-packages/
再次执行:
[root@v6i6v]# yum install python-devel
继续报错:
Traceback (most recent call last):
File "/usr/libexec/urlgrabber-ext-down", line 22, in
from urlgrabber.grabber import \
File "/opt/python27/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in
from grabber import urlgrab, urlopen, urlread
File "/opt/python27/lib/python2.7/site-packages/urlgrabber/grabber.py", line 512, in
import pycurl
ImportError: No module named pycurl
百度寻找解决方案如下
(1)yum install python-devel.x86_64。未解决
[root@v6i6v ~]# yum search python | grep -i python-devel
(2)安装libcurl-devel。无效
[root@v6i6v ~]# yum install -y libcurl4-openssl-dev
[root@v6i6v ~]# yum install libcurl-devel
(3)手动下载curl,pycurl,并指定路径安装pycurl
下载curl:https://curl.haxx.se/download.html
下载pycurl:https://pypi.python.org/pypi/pycurl/
安装过程:解压安装
[root@v6i6v ~]# tar -zxvf curl-7.48.0.tar.gz
[root@v6i6v ~]# tar -zxvf pycurl-7.43.0.tar.gz
[root@v6i6v ~]# cd curl-7.48.0
[root@v6i6v ~]# ./configure --prefix=/opt/curl
[root@v6i6v curl-7.48.0]# make && make install
[root@v6i6v curl-7.48.0]# cd ..
[root@v6i6v download]# cd pycurl-7.43.0
[root@v6i6v pycurl-7.43.0]# python setup.py install --curl-config=/opt/curl/bin/curl-config
ok终于搞定pycurl了。
[root@v6i6v download]# yum install python-devel
报错:
ImportError: pycurl: libcurl link-time version (7.29.0) is older than compile-time version (7.48.0)
升级libcurl:
[root@v6i6v download]# yum update libcurl
提示No packages marked for update
检查curl,libcurl,pycurl版本
[root@v6i6v download]# rpm -q curl
curl-7.29.0-25.el7.centos.x86_64
[root@v6i6v download]# rpm -q libcurl
libcurl-7.29.0-25.el7.centos.x86_64
[root@v6i6v download]# pip list
pip (8.1.1)
pycurl (7.43.0)
setuptools (20.9.0)
virtualenv (15.0.1)
wheel (0.29.0)
发现之前已经手动编译安装curl7.48.0到/opt/curl目录
修改指向现有curl的软连接为新安装的curl位置
首先备份原有curl软连接:
[root@v6i6v download]# mv /usr/bin/curl /usr/bin/curl7.29
新建软连接:
[root@v6i6v download]# ln -fs /opt/curl/bin/curl /usr/bin/curl
下载city-fan.org-release-1-13.devel.noarch.rpm地址:http://www.city-fan.org/ftp/contrib/yum-repo/
[root@v6i6v download]# rpm --nodeps -ivh city-fan.org-release-1-13.devel.noarch.rpm
[root@v6i6v download]# yum reinstall libcurl
还是不行,扯累了,去降级pycurl到7.29试试。
首先还原之前curl的软连接:
[root@v6i6v download]# rm -rf /usr/bin/curl
[root@v6i6v download]# mv /usr/bin/curl7.29 /usr/bin/curl
卸载pycurl,下载编译安装7.29:
[root@v6i6v download]# pip uninstall pycurl
折腾一轮后,好像不是pycurl问题。
还是重新编译安装curl和pycurl吧。安装curl时设置prefix了。
[root@v6i6v download]# rm -rf /opt/curl/
参照上面的编译安装方式,重新安装一次。
然后.....................................还是报错。
下载了libcurl7.23.rpm安装后
rpm -ivh libcurl4-7.23.0-1.i386.rpm --nodeps --force
rpm -ivh libcurl4-devel-7.23.0-1.i386.rpm --nodeps --force
运行安装python-devel也不行。。。
好坑啊。。。。。。
因为跳过依赖强制安装。。。。。。。。。。。
心中一万头草泥马飞过........................................................................................................................................................
要哭了,大神在哪里.......................................
重新安装centos系统,不管python-devel了。搞的现在yum都不能正常使用了
1:linux下源码编译
./configure --prefix=/usr/local/curl --disable-shared --enable-static --without-libidn --without-ssl --without-librtmp --without-gnutls --without-nss --without-libssh2 --without-zlib --without-winidn --disable-rtsp --disable-ldap --disable-ldaps --disable-ipv6
注意:不需要其它功能就disable,不然会在连接时报错, 如果你没有disable掉,但你的机器上又没有安装相应的库,link时会报错。
# python2.7.11 settings
PYTHON_HOME=/opt/python27
# curl7.48.0 settings
CURL_HOME=/opt/curl
PATH=$PATH:$PYTHON_HOME/bin:$CURL_HOME/bin
export PYTHON_HOME CURL_HOME PATH
1、Nginx环境搭建
yum
install
python-devel nginx