windows下conda安装及配置,解决遇到的问题

一、windows下conda安装
1.下载Miniconda
在这里插入图片描述
2.安装后配置环境变量
找到自己的安装路径,将下面三个路径添加到环境变量
D:\Users\grfood126\miniconda3
D:\Users\grfood126\miniconda3\Scripts
D:\Users\grfood126\miniconda3\Library\bin
二、conda配置
1.创建环境
D:\Users\grfood126\miniconda3\Library\bin

>conda create env

报错。提示:缺少值,需要一个名字或者前缀

CondaValueError: either -n NAME or -p PREFIX option required,
try "conda create -h" for more details

2.新建一个带前缀的环境 new_env

conda create -n new_env

3.激活环境

conda activate new_env

错误

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

4.根据提示运行conda init
刚开始报错,因为上面的环境变量没有配置完全,只配置了一个D:\Users\grfood126\miniconda3
查找了很多网上的错误修改方式,有的说是没有管理员身份运行,有的说是因为之前的虚拟环境没有退出source deactivate。都不行

WARNING: Cannot install xonsh wrapper without a python interpreter in prefix: C:
\Users\User1\AppData\Local\Temp\_MEI50762
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda.exe
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda-env.exe
modified      C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda-script.py
modified      C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\conda-env-script.py
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\conda.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Library\bin\conda.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\_conda_activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\rename_tmp.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\conda_auto_activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\conda_hook.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\activate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\condabin\deactivate.bat
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\activate
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\Scripts\deactivate
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\etc\profile.d\conda.sh

needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\etc\fish\conf.d\conda.fish
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\shell\condabin\Conda.psm1
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\shell\condabin\conda-hook.ps1
needs sudo    C:\Users\User1\AppData\Local\Temp\_MEI50762\etc\profile.d\conda.csh
modified      HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

==> For changes to take effect, close and re-open your current shell. <==
Operation failed.

在用powershell打开Anaconda Prompt (Miniconda3)时发现报错

conda : 无法将“conda”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一 次。

网上搜索问题后,发现配置conda时不止需要添加一个环境变量,修改环境变量后,conda init正常通过
5.重新激活环境
conda activate new_env
6.添加conda镜像
输入4行清华大学的通道代码

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
conda config --set show_channel_urls yes

7.删除镜像

conda config --remove channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
使用conda安装配置YOLOv4的过程如下所示: 1. 创建和激活虚拟环境: - 打开命令行终端(Windows用户可能需要以管理员身份运行)。 - 输入以下命令创建一个新的conda环境并激活它: ``` conda create --name yolo_env python=3.7 conda activate yolo_env ``` 2. 安装依赖项: - 在激活的环境中,使用以下命令安装必要的依赖项: ``` conda install numpy opencv matplotlib pillow ``` 3. 克隆YOLOv4仓库: - 使用以下命令克隆YOLOv4的GitHub仓库: ``` git clone https://github.com/AlexeyAB/darknet.git ``` 4. 配置编译参数: - 进入克隆的darknet目录: ``` cd darknet ``` - 打开`Makefile`文件并进行必要的更改: - 将`GPU=0`更改为`GPU=1`(如果你的系统支持GPU加速)。 - 根据你的系统,取消注释并选择合适的`ARCH`参数(例如,`ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]`)。 - 保存并关闭`Makefile`文件。 5. 编译YOLOv4: - 使用以下命令编译YOLOv4: ``` make ``` 6. 下载YOLOv4预训练权重: - 在darknet目录中,使用以下命令下载YOLOv4预训练权重: ``` wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights ``` 7. 运行YOLOv4: - 使用以下命令运行YOLOv4并检测图像(需要将`<image_path>`替换为你要检测的图像路径): ``` ./darknet detector test cfg/coco.data cfg/yolov4.cfg yolov4.weights <image_path> ``` 这些是使用conda安装配置YOLOv4的基本步骤。请注意,YOLOv4需要一定的计算资源和时间来进行编译和运行。如果你遇到任何问题,请参考YOLOv4的官方文档(https://github.com/AlexeyAB/darknet)进行进一步的调试和解决方案。希望对你有所帮助!如有其他问题,请随时提问。
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yuan86_12

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值