pip install -r requirements.txt
1.导出已有环境:
打开Anaconda?Prompt,输入
activate your_environment
来到自己要备份的虚拟环境下,然后输入
conda env export > environment.yaml
或者yml文件:
conda env export > environment.yml
或者txt文件:
conda list -e > requirements.txt
其中environment、requirements都可以根据自己的命名变化。
2.将输出的环境.yaml文件到开发板上复现环境时,可以:
conda create -n cloud xx.yaml/xx.yml/xx.txt
如果出现了
PackagesNotFoundError: The following packages are not available from current channels:
- xx.txt
Current channels:
- https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/linux-aarch64
- https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/noarch
- https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/linux-aarch64
- https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/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.
说明需要更换源,因为window和开发板上所需要的软件包不一样
就查看哪个软件包没有安装上
3. 以我要配置的ultralytics为例子:
pip install ultralytics
然后再进入当前程序文件夹下:
pip install -r requirements.txt
4. 运行过程出现AttributeError: module 'cv2.dnn' has no attribute 'DictValue'
说明目前安装的CV2版本不对,不包含DictValue
先卸载opencv-python。再安装对应版本
pip uninstall opencv-python
pip install opencv-python==4.5.1.48
5. 又出现了?No module named 'einops'、'timm'、torchsummary...
pip install einops
pip install timm
pip install torchsummary
pip install basicsr
运行成功!