Skip to content

macOS 安装失败 #1

@schoreZ

Description

@schoreZ

运行安装命令
pip install rqalpha-data
提示错误,并要求升级 pip,升级 pip 后,同样错误仍然存在,如下:
Collecting rqalpha-data
Using cached https://files.pythonhosted.org/packages/7b/c0/3496c1edf9c1ec4a7eaafc714fe62c8794935308c6aa1ba457b45fb8a4aa/rqalpha-data-0.0.7.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/17/n3ynjfmj41b3c67bgl8y47600000gn/T/pip-install-nshlbh9u/rqalpha-data/setup.py", line 7, in
from pip.req import parse_requirements
ImportError: cannot import name 'parse_requirements'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/17/n3ynjfmj41b3c67bgl8y47600000gn/T/pip-install-nshlbh9u/rqalpha-data/

查找解决办法,这个页面
https://stackoverflow.com/questions/25192794/no-module-named-pip-req
提到是 pip 版本的问题:

This is happening lately because of a change in pip 10.

The fix is pretty easy. You probably have something like:

from pip.req import parse_requirements
Change that to something like:

try: # for pip >= 10
    from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
    from pip.req import parse_requirements

最新的 pip 版本是19.0.1,是不是需要修改部分源码?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions