安装requirement.txt文件依赖
pip install -r requirements.txt
除了使用pip命令来生成及安装requirement.txt文件以外,也可以使用conda命令来安装。
conda install --yes --file requirements.txt
当你使用conda进行安装的时候经常出现以下错误:PackagesNotFoundError: The following packages are not available from current channels
Collecting package metadata (current_repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- igraph
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
你需要去https://anaconda.org 这个网址,在上方的搜索条上搜索你要安装这个包的其他channel,下边展示一下如何找igraph的其他channel
首先进入上述网址,我这里搜索igraph,会出现所有包名中包含“igraph”字段的包:
接着在你的命令行窗口或Anaconda Prompt窗口对应的路径下运行页面中提供的任意一条命令即可。