升级至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=0)
  File "/usr/lib/python3.6/site-packages/py3status/__init__.py", line 4, in <module>
    from py3status.core import Py3statusWrapper
  File "/usr/lib/python3.6/site-packages/py3status/core.py", line 22, in <module>
    from py3status.parse_config import process_config
  File "/usr/lib/python3.6/site-packages/py3status/parse_config.py", line 23, in <module>
    from py3status.private import PrivateHide, PrivateBase64
  File "/usr/lib/python3.6/site-packages/py3status/private.py", line 124, in <module>
    class PrivateBase64(Private):
TypeError: _catch() missing 1 required positional argument: 's'

py3status是i3wm status的python 替代品,用着还成,找了一下,在https://github.com/ultrabug/py3status/pull/610 找到解决办法,在以下目录

/sudo:root@localhost:/usr/lib/python3.6/site-packages/py3status/private.py

修改 116行

EXCLUDE = ['__init__', '__getattribute__', '__new__', '__setattr__']

EXCLUDE = ['__init__', '__getattribute__', '__new__', '__setattr__','__init_subclass__']

super + shift + r 重载i3wm

不管怎样,恭喜python发布新的版本