anaconda+pytorch

1.安装anaconda(包含3.6版本)比如anaconda 4.3.0.1

 

 

2.建立新的虚拟环境

windows:

打开anaconda navigator

environment -》 create 命名为 pytorch

open terminal

linux:

conda create -n pytorch_0_4 python=3.6

删除环境 conda remove -n pytorch --all

 

 

3.到网址查看安装命令,建议直接下载使用pip install ...安装

cpu版本:

conda install pytorch=0.4.1 torchvision=0.2.1 -c pytorch

https://pytorch.org/get-started/previous-versions/

或者到网址查看安装方法

https://blog.csdn.net/xiangxianghehe/article/details/80103095

     如果遇到安装完还出现 ModuleNotFoundError: No module named 'torchvision',再使用 pip install torchvision==0.2.1

 

4.
pip3 install http://download.pytorch.org/whl/cu90/torch-0.4.1-cp35-cp35m-linux_x86_64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple docker-compose --user
注:cu表示的是cuda的版本,cp表示的是python的版本,后面-i是下载的清华镜像
pip3 install torchvision==0.2.2 --user
旧版本的0.4.1的torch对应的torchvision是0.2.2的,要安装对应的版本
写的是对应的本地的安装方式,有sudo 权限的用sudo pip,去掉--user

 


5.安装cv相关

pip install opencv-python

直接安装不了可以试试以下语句

pip install --upgrade setuptools

python -m pip install --upgrade systemd-python 

pip install -i https://pypi.anaconda.org/meepio/simple opencv-python

pip install pygame --pre

之后再输入 pip install opencv-python 可能就好使了。

 

 

6.Anaconda安装第三方库,遇到PackageNotFoundError: ''Package missing in current channels" 完美解决

https://www.cnblogs.com/siyuan1998/p/13172557.html

 

 

 

----------------------------------------------------------------------

1.import torch
  File "D:\Python\Python36\lib\site-packages\torch\__init__.py", line 78, in <module>
    from torch._C import *
ImportError: DLL load failed: 找不到指定的模块。

问题解决参考:https://www.cnblogs.com/eniac1946/p/9210142.html

        https://blog.csdn.net/weixin_45357190/article/details/106936930

  • put the dll files in Library\bin into a dir
  • append the path of it to the environment variable PATH.
     
     

2。关于Anaconda中PackageNotFoundError: Package not found: '' Package missing in current win-64 channels错误

一、Anaconda作为一个工具包集成管理工具,下载python工具包是很方便的,直接敲:

conda install package_name

但是有时候安装一个工具包(如xmltodict)的时候,在当前的channels中找不到这个包,会提示:

conda install pydot Fetching package metadata ....... Solving package specifications: . PackageNotFoundError: Package not found: '' Package missing in current win-64 channels: - xmltodictYou can search for packages on anaconda.org with    anaconda search -t conda xmltodict

接着根据提示 输入  anaconda search -t conda xmltodict搜索结果:

125204_5vRn_1400660.png

现在就选择一个合适的版本进行安装,如我选择这个:

conda-forge/xmltodict | 0.10.2 | conda | linux-64, win-32, win-64, osx-64

那么执行下面命令进行安装即可:

conda install -c https://conda.anaconda.org/conda-forge xmltodict

二、直接使用pip install package_name命令并本地的工具库中加载安装

转载于:https://my.oschina.net/zlb1992/blog/781646

 

Windows系统下在Anaconda中使用bash
 conda install m2-base

之后运行bash没有问题
 

如果还不行,可以使用以下语句:

anaconda search -t conda m2-bash

找到了之后显示对应包的地址,比如

anaconda show conda-forge/m2-bash

之后根据提示安装

 

还不行的话需要安装git,具体安装查看:

https://www.cnblogs.com/itweb666/articles/15636639.html

https://blog.csdn.net/weixin_44774513/article/details/121354204

 

no module named 'tensorboardX'

如果不能使用

pip install tensorboardX

说明是源的问题,可以使用以下语句

pip install tensorboardX -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 

no module named 'skimage'

 

pip install scikit-image

说明是源的问题,可以使用以下语句

pip install scikit-image -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 

PermissionError: [WinError 5] 拒绝访问。: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-7jaqkppw\\pip\\pip\\_internal\\build_env.py'

加 --user 就行

(pytorch_LEAS) D:\deep learning\LEAStereo>pip install --user scikit-image -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

 

conda更新:

conda upgrade -n base -c defaults --override-channels conda

 

 The following packages are not available from current channels:    - python=3.1

 

posted on 2020-09-05 11:03  悟江居士  阅读(725)  评论(0编辑  收藏  举报

导航