1 #安装python3 去到某个特定的目录 2 #安装相关插件 3 yum install wget gcc openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel 4 5 wget --no-check-certificate https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz 6 tar -zxvf Python-3.5.0.tgz 7 cd Python-3.5.0 8 ./configure --prefix=/usr/local/python3.5 --enable-shared 9 make & make install 10 ln -s /usr/local/python3.5/bin/python3 /usr/bin/python3 11 12 #以上操作必须保证 有以下效果 13 ll /usr/local/python3.5/bin/python3 14 lrwxrwxrwx. 1 root root 9 6月 16 14:28 /usr/local/python3.5/bin/python3 -> python3.5 15 16 #修改 python 默认解析器 17 alias python=/usr/local/python3.5/bin/python3.5 18 python --version 19 #可能遇到这样的错,如果没有就进行下一步 20 # /usr/local/python3.5/bin/python3.5: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory 21 #解决方法 22 #注意 find / -name libpython3.5m.so.1.0 23 cd /home/temp/Python-3.5.0 24 cp libpython3.5m.so.1.0 /usr/local/lib64/ 25 cp libpython3.5m.so.1.0 /usr/lib/ 26 cp libpython3.5m.so.1.0 /usr/lib64/ 27 28 #安装setuptools 29 wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26 30 tar -zxvf setuptools-19.6.tar.gz 31 cd setuptools-19.6 32 python setup.py build 33 python setup.py install 34 35 #安装pip 36 wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb 37 tar -zxvf pip-8.0.2.tar.gz 38 cd pip-8.0.2 39 python setup.py build 40 python setup.py install 41 #查看 42 ll /usr/local/python3.5/bin/pip3 43 ln -s /usr/local/python3.5/bin/pip3 /usr/bin/pip3 44 ln -s /usr/local/python3.5/bin/pip3 /usr/bin/pip 45 pip install --upgrade pip 46 pip -V 47 pip3 install rsa
pip install django==2.0.6
python manage.py runserver 0.0.0.0:8006 --insecure
//问题 2019/02/12 File "/usr/local/python3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py", line 162, in get_new_connection conn = Database.connect(**conn_params) django.db.utils.NotSupportedError: URIs not supported vim /usr/local/python3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py 修改 kwargs.update({‘uri': False}) #这里原来是True,修改为False就可以了 return kwargs 把上面的uri对应True修改为False就ok了。 python manage.py runserver 0.0.0.0:8006 --insecure 就是正常了
因为yum包使用python2*等开发,修该为环境修改python3之后有问题,
解决:
修改文件/usr/bin/yum、/usr/libexec/urlgrabber-ext-down头中相应python为#!/usr/bin/python2.7
03-.tar.gz格式 解压:[*******]$ tar zxvf FileName.tar.gz 压缩:[*******]$ tar zcvf FileName.tar.gz DirName
ps -ef | grep python 查看python进程
sqlite3 -version
python -m django --version 查看 django 版本号
------------------------------------
linux 操作
查找并终止监听这个端口的程序
netstat -apn|grep 8006
ps -aux| grep 26406
kill -9 26406