admin管理员组文章数量:1577513
想安装指定版本的pytorch,指令(在cuda9下也可以安装):
conda install pytorch=0.1.10 -c soumith
然后,出现错误
安装出现HTTP 000 CONNECTION FAILED....
原因:是使用的是国外的镜像,需要切换至国内镜像
#使用conda config --show获取当前环境的配置信息
$conda config --show
add_anaconda_token: True
add_pip_as_python_dependency: True
aggressive_update_packages:
- ca-certificates
- certifi
- openssl
allow_non_channel_urls: False
allow_softlinks: False
always_copy: False
always_softlink: False
always_yes: None
anaconda_upload: None
auto_update_conda: True
changeps1: True
channel_alias: https://conda.anaconda
channel_priority: True
channels:[]
client_ssl_cert: None
client_ssl_cert_key: None
clobber: False
create_default_packages: []
custom_channels:
pkgs/main: https://repo.anaconda
pkgs/free: https://repo.anaconda
pkgs/r: https://repo.anaconda
pkgs/pro: https://repo.anaconda
home/lthpc/anaconda3/conda-bld: file://
custom_multichannels:
defaults: ["https://repo.anaconda/pkgs/main", "https://repo.anaconda/pkgs/free", "https://repo.anaconda/pkgs/r", "https://repo.anaconda/pkgs/pro"]
local: ["file:///home/lthpc/anaconda3/conda-bld"]
default_channels:
- https://repo.anaconda/pkgs/main
- https://repo.anaconda/pkgs/free
- https://repo.anaconda/pkgs/r
- https://repo.anaconda/pkgs/pro
disallowed_packages: []
download_only: False
envs_dirs:
- /home/lthpc/anaconda3/envs
- /home/lthpc/.conda/envs
force: False
json: False
local_repodata_ttl: 1
max_shlvl: 2
migrated_channel_aliases: []
no_dependencies: False
non_admin_enabled: True
notify_outdated_conda: True
offline: False
override_channels_enabled: True
path_conflict: clobber
pinned_packages: []
pkgs_dirs:
- /home/lthpc/anaconda3/pkgs
- /home/lthpc/.conda/pkgs
proxy_servers: {}
quiet: False
remote_connect_timeout_secs: 9.15
remote_max_retries: 3
remote_read_timeout_secs: 60.0
report_errors: None
rollback_enabled: True
safety_checks: warn
shortcuts: True
show_channel_urls: True
ssl_verify: False
track_features: []
use_index_cache: False
use_pip: True
verbosity: 0
whitelist_channels: []
而我们只想关注channels的,可以用指令conda config --show-source
$conda config --show-source
channels:[]
在conda安装好后,默认镜像是官方的,由于官方镜像在境外,访问太慢或者不能访问,为了能够加快访问速度,这里选择清华镜像
在命令行敲命令,设置清华的三个镜像
conda config --add channels https://mirrors.ustc.edu/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/free/
conda config --set show_channel_urls yes
还是出现错误,要去掉channels中的defaults
执行命令
conda config --remove defaults
在查看一下channels里的东西
$conda config --show-sources
==> /home/lthpc/.condarc <==
ssl_verify: False
channels:
- https://mirrors.ustc.edu/anaconda/pkgs/free/
- https://mirrors.tuna.tsinghua.edu/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/free/
show_channel_urls: true
再安装,--------又失败,重新换一下镜像,首先remove掉那三个,然后重新换链接
conda config --remove channels 'https://mirrors.ustc.edu/anaconda/pkgs/free/ '
conda config --remove channels 'https://mirrors.tuna.tsinghua.edu/anaconda/cloud/conda-forge/'
conda config --remove channels 'https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/free/'
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/cloud/bioconda/
结果还是不行。。。。终于换上中科大的镜像源,可以了。。
conda config --add channels https://mirrors.ustc.edu/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu/anaconda/cloud/menpo/
conda常用命令
#查看conda版本
conda --version
#查看python版本
python --version
#查看TensorFlow版本
#首先进去python环境,然后import
python
import tensorflow as tf
print(tf.__version__)
#查看pytorch版本,也是一样
python import torch
print(torch.__version__)
conda config命令
#显示当前环境的配置信息
$conda config --show
#只显示channels信息
$conda config --show-sources
==> /export/python2.7/.condarc <==
channels:
- https://mirror.tuna.tsinghua.edu/anacondafree
- https://mirror.tuna.tsinghua.edu/anaconda/main
show_channel_urls: True
#删除默认channel,增加国内镜像源,删除remove,增加add
$conda config --remove channels defaults
$ conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/main/
$ conda config --add channels https://mirrors.tuna.tsinghua.edu/anaconda/pkgs/free/
#从channel中安装包是不显示channel的url
#conda config --set show_channel_urls no
参考博客:
Anaconda更新失败解决方法:https://www.jianshu/p/c74668743932
conda常用命令详解:https://www.jianshu/p/484cfbf45ed3
版权声明:本文标题:使用conda安装旧版本torch0.2.0 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dianzi/1727790905a1129867.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论