Meituan-Dianping / lyrebird

移动应用插件化测试工作台
https://meituan-dianping.github.io/lyrebird/
MIT License
1.16k stars 246 forks source link

无法安装lyrebird #399

Closed astrid77 closed 3 years ago

astrid77 commented 3 years ago

Mac卸载lyrebird后重装,报错,无法成功安装,怎么解决呀~求助

image

中间很多报错信息。。。

image
zhaoye commented 3 years ago

你好,请多提供一些信息。 @astrid77 Python环境是怎么安装的?gcc是否正常可用?

可以参考下面的办法尝试排除问题

1. gcc可能存在问题的解决办法

Made sure I have the right version of gcc installed
Install xcode-select to fix the compiler error by selecting the right environment:

xcode-select --install

sudo xcode-select -switch /Applications/Xcode.app

Restarted Mac (important)

详见:https://stackoverflow.com/questions/64252434/architecture-not-supported-error-when-installing-nltk-with-pip-on-mac

2. python可能存在问题的解决办法

# 安装homebrew (详见https://brew.sh/)
 $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 
# 通过brew安装Python
brew install python
# 然后尝试重新安装Lyrebird
pip3 install lyrebird -U
astrid77 commented 3 years ago

现在不报错了,但是无法启动lyrebird

astrid77@MacBook-Pro ~ % pip3 install lyrebird
Requirement already satisfied: lyrebird in ./Library/Python/3.7/lib/python/site-packages (1.11.2)
Requirement already satisfied: Flask==1.1.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (1.1.1)
Requirement already satisfied: beautifulsoup4==4.7.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (4.7.1)
Requirement already satisfied: Flask-SocketIO==4.2.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (4.2.1)
Requirement already satisfied: SQLAlchemy==1.3.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (1.3.1)
Requirement already satisfied: portpicker==1.3.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (1.3.1)
Requirement already satisfied: click==6.7 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (6.7)
Requirement already satisfied: mitmproxy==4.0.4 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (4.0.4)
Requirement already satisfied: packaging==19.0 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (19.0)
Requirement already satisfied: colorama==0.4.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (0.4.1)
Requirement already satisfied: Flask-RESTful==0.3.7 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (0.3.7)
Requirement already satisfied: elasticsearch==7.0.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (7.0.1)
Requirement already satisfied: Pillow==7.0.0 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (7.0.0)
Requirement already satisfied: urllib3==1.24.2 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (1.24.2)
Requirement already satisfied: qrcode==6.1 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (6.1)
Requirement already satisfied: requests==2.21.0 in ./Library/Python/3.7/lib/python/site-packages (from lyrebird) (2.21.0)
Requirement already satisfied: itsdangerous>=0.24 in ./Library/Python/3.7/lib/python/site-packages (from Flask==1.1.1->lyrebird) (1.1.0)
Requirement already satisfied: Jinja2>=2.10.1 in ./Library/Python/3.7/lib/python/site-packages (from Flask==1.1.1->lyrebird) (2.11.2)
Requirement already satisfied: Werkzeug>=0.15 in ./Library/Python/3.7/lib/python/site-packages (from Flask==1.1.1->lyrebird) (1.0.1)
Requirement already satisfied: soupsieve>=1.2 in ./Library/Python/3.7/lib/python/site-packages (from beautifulsoup4==4.7.1->lyrebird) (2.0.1)
Requirement already satisfied: python-socketio>=4.3.0 in ./Library/Python/3.7/lib/python/site-packages (from Flask-SocketIO==4.2.1->lyrebird) (4.6.0)
Requirement already satisfied: ldap3<2.6,>=2.5 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (2.5.2)
Requirement already satisfied: sortedcontainers<2.1,>=1.5.4 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (2.0.5)
Requirement already satisfied: urwid<2.1,>=2.0.1 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (2.0.1)
Requirement already satisfied: pyasn1<0.5,>=0.3.1 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (0.4.8)
Requirement already satisfied: wsproto<0.12.0,>=0.11.0 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (0.11.0)
Requirement already satisfied: h2<4,>=3.0.1 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (3.2.0)
Requirement already satisfied: ruamel.yaml<0.16,>=0.13.2 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (0.15.100)
Requirement already satisfied: cryptography<2.4,>=2.1.4 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (2.3.1)
Requirement already satisfied: certifi>=2015.11.20.1 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (2020.6.20)
Requirement already satisfied: brotlipy<0.8,>=0.7.0 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (0.7.0)
Requirement already satisfied: pyperclip<1.7,>=1.6.0 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (1.6.5)
Requirement already satisfied: hyperframe<6,>=5.1.0 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (5.2.0)
Requirement already satisfied: tornado<5.2,>=4.3 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (5.1.1)
Requirement already satisfied: pyOpenSSL<18.1,>=17.5 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (18.0.0)
Requirement already satisfied: passlib<1.8,>=1.6.5 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (1.7.2)
Requirement already satisfied: pyparsing<2.3,>=2.1.3 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (2.2.2)
Requirement already satisfied: kaitaistruct<0.9,>=0.7 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (0.8)
Requirement already satisfied: blinker<1.5,>=1.4 in ./Library/Python/3.7/lib/python/site-packages (from mitmproxy==4.0.4->lyrebird) (1.4)
Requirement already satisfied: six in /usr/local/lib/python3.7/site-packages (from packaging==19.0->lyrebird) (1.15.0)
Requirement already satisfied: aniso8601>=0.82 in ./Library/Python/3.7/lib/python/site-packages (from Flask-RESTful==0.3.7->lyrebird) (8.0.0)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/site-packages (from Flask-RESTful==0.3.7->lyrebird) (2020.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./Library/Python/3.7/lib/python/site-packages (from requests==2.21.0->lyrebird) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./Library/Python/3.7/lib/python/site-packages (from requests==2.21.0->lyrebird) (2.8)
Requirement already satisfied: MarkupSafe>=0.23 in ./Library/Python/3.7/lib/python/site-packages (from Jinja2>=2.10.1->Flask==1.1.1->lyrebird) (1.1.1)
Requirement already satisfied: python-engineio>=3.13.0 in ./Library/Python/3.7/lib/python/site-packages (from python-socketio>=4.3.0->Flask-SocketIO==4.2.1->lyrebird) (3.13.2)
Requirement already satisfied: h11~=0.7.0 in ./Library/Python/3.7/lib/python/site-packages (from wsproto<0.12.0,>=0.11.0->mitmproxy==4.0.4->lyrebird) (0.7.0)
Requirement already satisfied: hpack<4,>=3.0 in ./Library/Python/3.7/lib/python/site-packages (from h2<4,>=3.0.1->mitmproxy==4.0.4->lyrebird) (3.0.0)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in ./Library/Python/3.7/lib/python/site-packages (from cryptography<2.4,>=2.1.4->mitmproxy==4.0.4->lyrebird) (1.14.2)
Requirement already satisfied: asn1crypto>=0.21.0 in ./Library/Python/3.7/lib/python/site-packages (from cryptography<2.4,>=2.1.4->mitmproxy==4.0.4->lyrebird) (1.4.0)
Requirement already satisfied: pycparser in ./Library/Python/3.7/lib/python/site-packages (from cffi!=1.11.3,>=1.7->cryptography<2.4,>=2.1.4->mitmproxy==4.0.4->lyrebird) (2.20)
astrid77@MacBook-Pro ~ % lyrebird
zsh: command not found: lyrebird
zhaoye commented 3 years ago

看不出来什么问题,可以上传更完整的日志。

可以看出来的是使用了系统自带的Python3,不知道你的具体配置pip3和python3是不是使用了同一个python。 还是比较推荐使用brew安装的python,会省去不少麻烦

如果不清理python环境的话,可以做如下尝试:

  1. 安装Lyrebird
    python3 -m pip install lyrebird
  2. 启动Lyrebird
    python3 -m lyrebird

@astrid77

astrid77 commented 3 years ago

python3.7和python3.8都有,怎么判断pip3和python3是不是使用了同一个python?清理python环境的话直接删掉其中一个python包就可以吗?

pip3路径/usr/local/bin/pip3 python3路径/usr/local/bin/python3

按上述回复操作后,python3 -m lyrebird好像可以成功启动lyrebird,是否这样就算OK了呢?

astrid77@MacBook-Pro ~ % python3 -m lyrebird
NOTICE [manager] 

     _                    _     _         _ 
    | |                  | |   (_)       | |
    | |    _   _ _ __ ___| |__  _ _ __ __| |
    | |   | | | | '__/ _ \ '_ \| | '__/ _' |
    | |___| |_| | | |  __/ |_) | | | | (_| |
    \_____/\__, |_|  \___|_.__/|_|_|  \__,_|
            __/ |                           
           |___/                            

                   v1.11.2

 * Serving Flask app "MOCK" (lazy loading)
 * Environment: development
 * Debug mode: off
ERROR [device_service] Environment variable ANDROID_HOME not found!
[2020-10-28 20:37:24,072] ERROR in app: Exception on /plugins/bugit/api/template [GET]
Traceback (most recent call last):
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask_restful/__init__.py", line 269, in error_router
    return original_handler(e)
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/lyrebird_bugit/apis.py", line 24, in template
    templates = template_loader.template_list()
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/lyrebird_bugit/template_loader.py", line 28, in template_list
    for template_file in get_workspace().iterdir():
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/lyrebird_bugit/template_loader.py", line 17, in get_workspace
    ROOT = application._cm.root
AttributeError: 'ConfigManager' object has no attribute 'root'
ERROR [device_service] Environment variable ANDROID_HOME not found!
ERROR [core] plugin error tracking
Traceback (most recent call last):
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/lyrebird/mock/blueprints/core.py", line 55, in index
    plugin.handle(req_context)
  File "/Users/astrid77/Library/Python/3.7/lib/python/site-packages/lyrebird_tracking/tracking.py", line 23, in handle
    url = handler_context.get_origin_url()
AttributeError: 'HandlerContext' object has no attribute 'get_origin_url'
zhaoye commented 3 years ago

首先,抱歉回复晚了。 @astrid77

如果有多个python不好判断版本也可以这样做:

# 1. 在当前的python3中安装lyrebird
python3 -m pip install lyrebird

# 2. 在当前的python3中启动lyrebird
python3 -m lyrebird

另外,上面的报错应该是版本不兼容的问题。pip安装时可以增加-U来要求更新。

python3 -m pip install lyrebird lyrebird-ios lyrebird-android -U