Anaconda安装虚拟环境

anaconda安装好之后,有个默认的环境base,可以在anaconda powershell prompt中输入指令conda info -e进行查看,安装新的虚拟环境操作如下。

1.首先,在anaconda powershell prompt中执行以下命令更换镜像:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

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/msys2/

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --set show_channel_urls yes

2.建立连接,如果不进行此步,则安装的虚拟环境会在C盘,操作如下:
(1)在C盘users文件夹下找到.conda文件夹,并把这个.conda文件夹移到自己想要存放的位置,然后删除C盘的.conda文件夹。
(2)然后用管理员命令打开cmd,输入指令mklink/J "C:\Users\dongxiaofeng\.conda" "目标路径\.conda",目标路径自己写。

3.创建虚拟环境并安装包
(1)在anaconda powershell prompt中执行以下指令:

conda create -n 环境名称 python=3.8

“环境名称”是自己命名,为英文符,其中3.8是python的版本号
(2)默认值base环境,此时要激活自己创建的虚拟环境,在anaconda powershell prompt使用conda activate 环境名进行激活,接下来用pip安装包,在anaconda powershell prompt中分别执行以下指令:

pip install numpy==1.18.5 -i https://pypi.douban.com/simple/
pip install tensorflow==2.3.0 -i https://pypi.douban.com/simple/
pip install keras -i https://pypi.douban.com/simple/
pip install IPython -i https://pypi.douban.com/simple/
pip install pydotplus -i https://pypi.douban.com/simple/
conda install basemap
pip install pyproj -i https://pypi.douban.com/simple/
pip install geos -i https://pypi.douban.com/simple/
pip install matplotlib -i https://pypi.douban.com/simple/
pip install scikit-learn -i https://pypi.douban.com/simple/
pip install scikit-image -i https://pypi.douban.com/simple/
conda install pandas
pip install scipy -i https://pypi.douban.com/simple/
pip install graphviz-i https://pypi.douban.com/simple/
pip install mlxtend -i https://pypi.douban.com/simple/
pip install xgboost -i https://pypi.douban.com/simple/
pip install seaborn -i https://pypi.douban.com/simple/
pip install jupyter -i https://pypi.douban.com/simple/

其中,mlpy这个库需要本地安装,先下载mlpy轮子文件,然后在mlpy所在的文件夹中执行指令pip install mlpy-3.5.0-cp38-cp38-win_amd64.whl(我下载的是这个文件),就可以了。

以上,是我同学帮助我的,再次感谢那个同学。

  • 2
    点赞
  • 20
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值