No module named 'torchsample' 问题解决

anaconda prompt中依次输入命令

conda install git
pip install -e git+https://github.com/ncullen93/torchsample.git#egg=torchsample
pip install visdom
pip install nibabel
pip install h5py 

注意这时候torchsample是安装在anaconda prompt的默认路径(我的是C:\Users\SSMM>src)的,

从这个路径直接进python是可以的

(base) C:\Users\SSMM>python
Python 3.7.4 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torchsample
>>>

如果这个路径不在anaconda解释器的模块搜索路径,则要么把这个路径添加为搜索路径,要么把torchsample文件夹全部复制到一个搜索路径下

在这里插入图片描述
模块搜索路径查看:

在这里插入图片描述

我复制到D:\ProgramData\Anaconda3\Lib\site-packages了

不报错啦

在这里插入图片描述
具体安装过程


(base) C:\Users\SSMM>pip3 install git
Collecting git
  ERROR: Could not find a version that satisfies the requirement git (from versions: none)
ERROR: No matching distribution found for git
WARNING: You are using pip version 19.2.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(base) C:\Users\SSMM>conda install git
Collecting package metadata (current_repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\ProgramData\Anaconda3

  added / updated specs:
    - git


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    git-2.23.0                 |                2        92.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
    ------------------------------------------------------------
                                           Total:        92.9 MB

The following NEW packages will be INSTALLED:

  git                anaconda/cloud/conda-forge/win-64::git-2.23.0-2


Proceed ([y]/n)? y


Downloading and Extracting Packages
git-2.23.0           | 92.9 MB   | ################################################################################################################################################################################################# | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: / DEBUG menuinst_win32:__init__(199): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'D:\ProgramData\Anaconda3', env_name: 'None', mode: 'system', used_mode: 'system'
DEBUG menuinst_win32:create(323): Shortcut cmd is D:\ProgramData\Anaconda3\python.exe, args are ['D:\\ProgramData\\Anaconda3\\cwp.py', 'D:\\ProgramData\\Anaconda3', 'D:\\ProgramData\\Anaconda3\\Library\\bin\\bash.exe', '--login', '-i', '--']
done

(base) C:\Users\SSMM>conda install -e git+https://github.com/ncullen93/torchsample.git#egg=torchsample
usage: conda-script.py [-h] [-V] command ...
conda-script.py: error: unrecognized arguments: -e

(base) C:\Users\SSMM>pip3 install -e git+https://github.com/ncullen93/torchsample.git#egg=torchsample
Obtaining torchsample from git+https://github.com/ncullen93/torchsample.git#egg=torchsample
  Cloning https://github.com/ncullen93/torchsample.git to c:\users\ssmm\src\torchsample
  Running command git clone -q https://github.com/ncullen93/torchsample.git 'C:\Users\SSMM\src\torchsample'
Installing collected packages: torchsample
  Running setup.py develop for torchsample
Successfully installed torchsample
WARNING: You are using pip version 19.2.1, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(base) C:\Users\SSMM>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 66kB/s
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-19.3.1

(base) C:\Users\SSMM>pip3 install visdom
Collecting visdom
  Downloading https://files.pythonhosted.org/packages/c9/75/e078f5a2e1df7e0d3044749089fc2823e62d029cc027ed8ae5d71fafcbdc/visdom-0.1.8.9.tar.gz (676kB)
     |████████████████████████████████| 686kB 297kB/s
Requirement already satisfied: numpy>=1.8 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from visdom) (1.17.0)
Requirement already satisfied: scipy in d:\programdata\anaconda3\lib\site-packages (from visdom) (1.3.1)
Requirement already satisfied: requests in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from visdom) (2.21.0)
Requirement already satisfied: tornado in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from visdom) (6.0.2)
Requirement already satisfied: pyzmq in d:\programdata\anaconda3\lib\site-packages (from visdom) (18.1.0)
Requirement already satisfied: six in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from visdom) (1.12.0)
Collecting jsonpatch
  Downloading https://files.pythonhosted.org/packages/86/7e/035d19a73306278673039f0805b863be8798057cc1b4008b9c8c7d1d32a3/jsonpatch-1.24-py2.py3-none-any.whl
Collecting torchfile
  Downloading https://files.pythonhosted.org/packages/91/af/5b305f86f2d218091af657ddb53f984ecbd9518ca9fe8ef4103a007252c9/torchfile-0.1.0.tar.gz
Collecting websocket-client
  Downloading https://files.pythonhosted.org/packages/29/19/44753eab1fdb50770ac69605527e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-none-any.whl (200kB)
     |████████████████████████████████| 204kB 233kB/s
Requirement already satisfied: pillow in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from visdom) (6.1.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from requests->visdom) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from requests->visdom) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from requests->visdom) (2019.3.9)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from requests->visdom) (1.24.3)
Collecting jsonpointer>=1.9
  Downloading https://files.pythonhosted.org/packages/18/b0/a80d29577c08eea401659254dfaed87f1af45272899e1812d7e01b679bc5/jsonpointer-2.0-py2.py3-none-any.whl
Building wheels for collected packages: visdom, torchfile
  Building wheel for visdom (setup.py) ... done
  Created wheel for visdom: filename=visdom-0.1.8.9-cp37-none-any.whl size=655257 sha256=49a3aa7ea86cc5b169bfb26b6269d74ad9c4f68e88f51291447e0c198dda0673
  Stored in directory: C:\Users\SSMM\AppData\Local\pip\Cache\wheels\70\19\a7\6d589ed967f4dfefd33bc166d081257bd4ed0cb618dccfd62a
  Building wheel for torchfile (setup.py) ... done
  Created wheel for torchfile: filename=torchfile-0.1.0-cp37-none-any.whl size=5716 sha256=c25ea84bef4e2fae42718621573126df629c91a7379d8642198783714e417d65
  Stored in directory: C:\Users\SSMM\AppData\Local\pip\Cache\wheels\b1\c3\d6\9a1cc8f3a99a0fc1124cae20153f36af59a6e683daca0a0814
Successfully built visdom torchfile
Installing collected packages: jsonpointer, jsonpatch, torchfile, websocket-client, visdom
Successfully installed jsonpatch-1.24 jsonpointer-2.0 torchfile-0.1.0 visdom-0.1.8.9 websocket-client-0.56.0

(base) C:\Users\SSMM>pip3 install nibabel
Collecting nibabel
  Downloading https://files.pythonhosted.org/packages/01/13/392132019093ddb7bc997f7f9843d406dc3302a27f01827d2fd028e03c50/nibabel-2.5.1-py3-none-any.whl (3.3MB)
     |████████████████████████████████| 3.3MB 656kB/s
Requirement already satisfied: numpy>=1.8 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from nibabel) (1.17.0)
Requirement already satisfied: six>=1.3 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from nibabel) (1.12.0)
Installing collected packages: nibabel
Successfully installed nibabel-2.5.1

(base) C:\Users\SSMM>pip3 install h5py
Requirement already satisfied: h5py in d:\programdata\anaconda3\lib\site-packages (2.9.0)
Requirement already satisfied: six in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from h5py) (1.12.0)
Requirement already satisfied: numpy>=1.7 in c:\users\ssmm\appdata\roaming\python\python37\site-packages (from h5py) (1.17.0)

(base) C:\Users\SSMM>
发布了190 篇原创文章 · 获赞 65 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_36607894/article/details/103094777