升级至python3.6导致环境出错解决

Posted in 2017-1-9 23:40 | Category: Linux | Tags: python3 linux python i3wm

最近archlinux升级至了 python3.6 ,直接导致了我的开发环境失效,唉

archlinux 果然不适合开发

虽然后面都已经解决了

事故(一)

virtualenv不可用,原先使用python3.5创建的环境直接不能用了,只好删了原有了东西,重新使用python3.6创建

pip freeze > requestments.txt
pip install -r requestments.txt

事故(二)

py3status 报错

   Traceback (most recent call last):
  File "/usr/bin/py3status", line 11, in <module>
    load_entry_point('py3status==3.3', 'console_scripts', 'py3status')()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 561, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level …

flask应用部署——安装环境

Posted in 2016-1-6 0:58 | Category: Linux | Tags: nginx python3 linux flask

虽然以前安装过但是没有记录,这次重新安装,趁机记录下来,省得满世界地找

环境: centos7

安装nginx

参考资料
使用yum list nginx会发现nginx是1.6的版本,但现在nginx已经到了1.9,虽然不必那么新, 但是过旧的版本说不定会出现安全问题

# vim /etc/yum.repos.d/nginx.repo

输入

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

然后

# yum list nginx  #你会发现nginx已经是1.8的版本
# yum install nginx
# systemctl start nginx #启动nginx

安装python3

centos7默认安装了python2.7的版本,但我习惯用python3,但是centos无法通过yum install python3安装, 只好自己编译了

安装必要的文件

# yum groupinstall "Development tools"
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel 
readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

下载python3源码

python3已到的python3.5,请按自己的需求下载

$ wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz
$ tar xz Python-3.4.4.tgz
$ cd Python-3.4.4
$ ./configure
$ make
# make install

如果提示c 编译器未找到
yum install gcc gcc-c++

安装supervisor

编译安装python3的时候python3-pip就已经安装好了

# pip3 install supervisor
Collecting supervisor
  Downloading supervisor-3 …