C:\Users\Administrator>conda install pytorch torchvision cpuonly
Collecting package metadata (current_repodata.json): done
【Solving environment: failed with current_repodata.json, will retry with next repodata source.】
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- cpuonly
- torchvision
Current channels:
- https://repo.anaconda.com/pkgs/main/win-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/win-64
- https://repo.anaconda.com/pkgs/r/noarch
- https://repo.anaconda.com/pkgs/msys2/win-64
- https://repo.anaconda.com/pkgs/msys2/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
1.2.2 pip安装
C:\Users\Administrator>pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.7.0+cpu
Downloading https://download.pytorch.org/whl/cpu/torch-1.7.0%2Bcpu-cp37-cp37m-win_amd64.whl (184.2MB)
|████████████████████████████████| 184.2MB 111kB/s
Collecting torchvision==0.8.1+cpu
Downloading https://download.pytorch.org/whl/cpu/torchvision-0.8.1%2Bcpu-cp37-cp37m-win_amd64.whl (808kB)
|████████████████████████████████| 808kB 3.2MB/s
Collecting torchaudio===0.7.0
Downloading https://download.pytorch.org/whl/torchaudio-0.7.0-cp37-none-win_amd64.whl (103kB)
|████████████████████████████████| 112kB 6.8MB/s
Collecting dataclasses (from torch==1.7.0+cpu)
Downloading https://files.pythonhosted.org/packages/26/2f/1095cdc2868052dd1e64520f7c0d5c8c550ad297e944e641dbf1ffbb9a5d/dataclasses-0.6-py3-none-any.whl
Requirement already satisfied: numpy in d:\anaco\lib\site-packages (from torch==1.7.0+cpu) (1.16.4)
Collecting typing-extensions (from torch==1.7.0+cpu)
Downloading https://files.pythonhosted.org/packages/60/7a/e881b5abb54db0e6e671ab088d079c57ce54e8a01a3ca443f561ccadb37e/typing_extensions-3.7.4.3-py3-none-any.whl
Requirement already satisfied: future in d:\anaco\lib\site-packages (from torch==1.7.0+cpu) (0.17.1)
Requirement already satisfied: pillow>=4.1.1 in d:\anaco\lib\site-packages (from torchvision==0.8.1+cpu) (6.1.0)
Installing collected packages: dataclasses, typing-extensions, torch, torchvision, torchaudio
Successfully installed dataclasses-0.6 torch-1.7.0+cpu torchaudio-0.7.0 torchvision-0.8.1+cpu typing-extensions-3.7.4.3
C:\Users\Administrator>python
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> import torchvision
C:\Users\Administrator>pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/a4/7b/2f7f29f460629a8143b2deea1911e2fb1d9d88d29bf645ba321461588e88/dlib-19.21.0.tar.gz
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) ... error
ERROR: Complete output from command 'D:\anaco\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-mnnw0u32\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-wheel-li1ra7jv' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Traceback (most recent call last):
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "D:\anaco\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "D:\anaco\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\anaco\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "D:\anaco\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 262, in <module>
'Topic :: Software Development',
File "D:\anaco\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "D:\anaco\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\anaco\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\anaco\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\anaco\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "D:\anaco\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\anaco\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\anaco\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\anaco\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\anaco\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 125, in get_cmake_version
"\n*******************************************************************\n")
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: _dlib_pybind11
*******************************************************************
----------------------------------------
ERROR: Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Complete output from command 'D:\anaco\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-mnnw0u32\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-bk7xkgd2\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Traceback (most recent call last):
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 120, in get_cmake_version
out = subprocess.check_output(['cmake', '--version'])
File "D:\anaco\lib\subprocess.py", line 395, in check_output
**kwargs).stdout
File "D:\anaco\lib\subprocess.py", line 472, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\anaco\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "D:\anaco\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 262, in <module>
'Topic :: Software Development',
File "D:\anaco\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "D:\anaco\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "D:\anaco\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "D:\anaco\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\anaco\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "D:\anaco\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "D:\anaco\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\anaco\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "D:\anaco\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "D:\anaco\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "D:\anaco\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 129, in run
cmake_version = self.get_cmake_version()
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\setup.py", line 125, in get_cmake_version
"\n*******************************************************************\n")
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: _dlib_pybind11
*******************************************************************
----------------------------------------
ERROR: Command "'D:\anaco\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-install-mnnw0u32\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\ADMINI~1\AppData\Local\Temp\pip-record-bk7xkgd2\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ADMINI~1\AppData\Local\Temp\pip-install-mnnw0u32\dlib\
第三种方式成功安装(注意版本对应):
C:\Users\Administrator>python -V
Python 3.7.3
C:\Users\Administrator>pip install dlib-19.17.99-cp37-cp37m-win_amd64.whl
Processing c:\users\administrator\dlib-19.17.99-cp37-cp37m-win_amd64.whl
Installing collected packages: dlib
Successfully installed dlib-19.17.99
C:\Users\Administrator>pip show dlib
Name: dlib
Version: 19.17.99
Summary: A toolkit for making real world machine learning and data analysis applications
Home-page: https://github.com/davisking/dlib
Author: Davis King
Author-email: [email protected]
License: Boost Software License
Location: d:\anaco\lib\site-packages
Requires:
Required-by:
C:\Users\Administrator>python
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib