安装mmcv,我选择的是源码安装,按照官方给出的步骤,运行命令
MMCV_WITH_OPS=1 pip install -e .
出现错误提示,如下:
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse(‘pytest-runner’)
于是安装pytest-runner:
pip install pytest-runner
随后再次运行安装命令,仍然出现错误,于是仔细阅读setup.py的源码:
# 前面代码的省略
setup(
name='mmcv' if os.getenv('MMCV_WITH_OPS', '0') == '0' else 'mmcv-full',
version=get_version(),
description='OpenMMLab Computer Vision Foundation',
keywords='computer vision',
packages=find_packages(),
include_package_data=True,
classifiers=[
'Development Status :: 4 - Beta',
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Utilities',
],
url='https://github.com/open-mmlab/mmcv',
author='MMCV Authors',
author_email='chenkaidev@gmail.com',
setup_requires=['pytest-runner'],
tests_require=['pytest'],
install_requires=install_requires,
ext_modules=get_extensions(),
cmdclass={'build_ext': BuildExtension},
zip_safe=False)
发现它依赖几个安装包,分别在 setup_requires、tests_requires、install_requires中定义,具体有如下需提前安装:
pytest-runner
pytest
addict
numpy
pyyaml
yapf
opencv-python
安装好后,执行mmcv安装命令,大功告成!