在conda中创建requirements.txt文件时不显示版本信息。
在使用conda创建requirements.txt文件时,不会显示版本号的原因是因为conda不会导出符合PyPI包规范的版本信息。解决方法是可以使用以下命令导出符合conda规范的包列表,并通过conda进行安装:
conda list --export > requirements.txt conda install --file requirements.txt
另外,也可以使用以下命令将包列表导出为符合pip规范的版本信息:
pip list --format=freeze > requirements.txt
然而,需要注意的是,使用conda导出的包列表将包含conda自身的包,而不是PyPI的包,因此可能不兼容使用pip进行安装:
pip install -r requirements.txt
因此,如果需要导出符合PyPI规范的包列表,建议使用pip命令导出requirements.txt文件。