anconda 日常使用问题

ubuntu18 conda 4.8.3
常用命令
conda -V
conda env list
conda create -n your_env_name python=X.X(2.7、3.7等)
conda activate your_env_name
conda deactivate
conda remove -n your_env_name --all

源 -- 有时候清华源出问题,备用
-i https://mirrors.aliyun.com/pypi/simple/  # 阿里云 
-i https://pypi.mirrors.ustc.edu.cn/simple/  # 中国科技大学 
-i http://pypi.douban.com/simple/  # 豆瓣 
-i http://pypi.mirrors.ustc.edu.cn/simple/  # 中国科学技术大学 
问题1 CondaHTTPError: HTTP 000 CONNECTION FAILED for url
(base) ubuntu@ubuntu:/data/chengzhang/yolov5$ conda create -n cz python=3.7

Collecting package metadata (current\|failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch'
解决办法
# 首先先添加清华的镜像源
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/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

(base) ubuntu@ubuntu:~$ cp ~/.condarc ~/.condarc.bak  # 以防万一备份用
(base) ubuntu@ubuntu:~$ vim .condarc
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
- http://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud
- defaults
- http://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
- http://nanomirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/conda
- bioconda
- r
- conda-forge
show_channel_urls: true

# 删除 defaults 内容 如下保存退出
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
show_channel_urls: true

参考链接

问题2:段错误 (核心已转储)
conda clean -a  # 删除索引缓存、锁定文件、未使用过的包和tar包,一般可以解决,按照提示按两次 y

(base) ubuntu@ubuntu:/data/chengzhang/yolov5$ conda clean -a
Cache location: /home/ubuntu/anaconda3/pkgs
Will remove the following tarballs:

/home/ubuntu/anaconda3/pkgs
---------------------------
ca-certificates-2020.6.20-hecda079_0.tar.bz2     145 KB
setuptools-49.6.0-py37hc8dfbb8_0.tar.bz2     948 KB
wheel-0.35.1-pyh9f0ad1d_0.tar.bz2             29 KB
python-3.7.8-h6f2ec95_1_cpython.tar.bz2      3.6 MB
libgomp-9.3.0-h24d8f2e_16.tar.bz2            378 KB
libstdcxx-ng-9.3.0-hdf63c60_16.tar.bz2       4.0 MB
sqlite-3.33.0-h4cf870e_0.tar.bz2             1.4 MB
python_abi-3.7-1_cp37m.tar.bz2                 4 KB
_openmp_mutex-4.5-1_gnu.tar.bz2               22 KB
_libgcc_mutex-0.1-conda_forge.tar.bz2          3 KB
openssl-1.1.1g-h516909a_1.tar.bz2            2.1 MB
libgcc-ng-9.3.0-h24d8f2e_16.tar.bz2          7.8 MB
xz-5.2.5-h516909a_1.tar.bz2                  343 KB
pip-20.2.3-py_0.tar.bz2                      1.1 MB
certifi-2020.6.20-py37hc8dfbb8_0.tar.bz2     151 KB
ncurses-6.2-he1b5a44_1.tar.bz2               993 KB
readline-8.0-he28a2e2_2.tar.bz2              281 KB
zlib-1.2.11-h516909a_1009.tar.bz2            106 KB
ld_impl_linux-64-2.35-h769bd43_9.tar.bz2     512 KB

---------------------------------------------------
Total:                                      23.9 MB

Proceed ([y]/n)? y

Removed ca-certificates-2020.6.20-hecda079_0.tar.bz2
Removed setuptools-49.6.0-py37hc8dfbb8_0.tar.bz2
Removed wheel-0.35.1-pyh9f0ad1d_0.tar.bz2
Removed python-3.7.8-h6f2ec95_1_cpython.tar.bz2
Removed libgomp-9.3.0-h24d8f2e_16.tar.bz2
Removed libstdcxx-ng-9.3.0-hdf63c60_16.tar.bz2
Removed sqlite-3.33.0-h4cf870e_0.tar.bz2
Removed python_abi-3.7-1_cp37m.tar.bz2
Removed _openmp_mutex-4.5-1_gnu.tar.bz2
Removed _libgcc_mutex-0.1-conda_forge.tar.bz2
Removed openssl-1.1.1g-h516909a_1.tar.bz2
Removed libgcc-ng-9.3.0-h24d8f2e_16.tar.bz2
Removed xz-5.2.5-h516909a_1.tar.bz2
Removed pip-20.2.3-py_0.tar.bz2
Removed certifi-2020.6.20-py37hc8dfbb8_0.tar.bz2
Removed ncurses-6.2-he1b5a44_1.tar.bz2
Removed readline-8.0-he28a2e2_2.tar.bz2
Removed zlib-1.2.11-h516909a_1009.tar.bz2
Removed ld_impl_linux-64-2.35-h769bd43_9.tar.bz2
WARNING: /home/ubuntu/.conda/pkgs does not exist
Cache location: /home/ubuntu/anaconda3/pkgs
Will remove the following packages:
/home/ubuntu/anaconda3/pkgs
---------------------------

sqlite-3.33.0-h4cf870e_0                     3.3 MB
setuptools-49.6.0-py37hc8dfbb8_0             3.9 MB
certifi-2020.6.20-py37hc8dfbb8_0             299 KB
ncurses-6.2-he1b5a44_1                       4.9 MB
_libgcc_mutex-0.1-conda_forge                  6 KB
openssl-1.1.1g-h516909a_1                    6.0 MB
wheel-0.35.1-pyh9f0ad1d_0                    108 KB
ca-certificates-2020.6.20-hecda079_0         286 KB
libgomp-9.3.0-h24d8f2e_16                    1.1 MB
ld_impl_linux-64-2.35-h769bd43_9             1.7 MB
zlib-1.2.11-h516909a_1009                    379 KB
xz-5.2.5-h516909a_1                          1.2 MB
readline-8.0-he28a2e2_2                      1.1 MB
libstdcxx-ng-9.3.0-hdf63c60_16              12.6 MB
python_abi-3.7-1_cp37m                        10 KB
pip-20.2.3-py_0                              4.6 MB
libgcc-ng-9.3.0-h24d8f2e_16                 24.6 MB
_openmp_mutex-4.5-1_gnu                       93 KB

---------------------------------------------------
Total:                                      66.2 MB

Proceed ([y]/n)? y

removing sqlite-3.33.0-h4cf870e_0
removing setuptools-49.6.0-py37hc8dfbb8_0
removing certifi-2020.6.20-py37hc8dfbb8_0
removing ncurses-6.2-he1b5a44_1
removing _libgcc_mutex-0.1-conda_forge
removing openssl-1.1.1g-h516909a_1
removing wheel-0.35.1-pyh9f0ad1d_0
removing ca-certificates-2020.6.20-hecda079_0
removing libgomp-9.3.0-h24d8f2e_16
removing ld_impl_linux-64-2.35-h769bd43_9
removing zlib-1.2.11-h516909a_1009
removing xz-5.2.5-h516909a_1
removing readline-8.0-he28a2e2_2
removing libstdcxx-ng-9.3.0-hdf63c60_16
removing python_abi-3.7-1_cp37m
removing pip-20.2.3-py_0
removing libgcc-ng-9.3.0-h24d8f2e_16
removing _openmp_mutex-4.5-1_gnu

问题3:pip install .whl 提示解释器错误 bash: /home/anconda/bin/pip:********/python/bin/python3.7
bash: /home/anconda/bin/pip:*********/python/bin/python3.7:解释器错误: 没有那个文件或目录
解决办法:
python -m pip install *.whl   # 或者
python3 -m pip install *.whl  # 根据自己默认环境选择

在这里插入图片描述

问题4 win安装 pycocotools 提示 ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly
看过很多博主的教程有的还要安装VS,有的是下载代码,然后pip,最后是浪费了时间没有解决,直接看大佬这个一步搞定

原文地址

根据自己的python版本进行下载,pip安装
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值