windows10-64位系统下Install GraphLab Create with Command Line

本文详细介绍了GraphLab Create在Windows 10系统上的安装过程,包括安装Anaconda、配置环境变量、安装GraphLab Create及验证安装成功的方法。

一、安装环境:windows10-64位
GraphLab Create的官网有安装步骤,但是对于小白的我来说,有几个坑在里边(https://turi.com/download/install-graphlab-create-command-line.html)
二、正确的安装:

Step 1: Download Anaconda2 v4.0.0
Step 2: Install Anaconda
# Run Anaconda2 v4.0.0 installer.
# Double-click the .exe file to install Anaconda and follow the instructions on the screen.
1.关闭杀毒软件:例如360
2.把系统的环境变量PATH里的自己配的path删掉一些,否则anaconda安装不成功。
3.右击Anaconda2-4.0.0-Windows-x86_64.exe,以管理员身份运行。
(详细的看我上一篇博客https://blog.youkuaiyun.com/xiaohanwang/article/details/89028262)

Step 3: Create conda environment
# Create a new conda environment with Python 2.7.x
conda create -n gl-env python=2.7 anaconda=4.0.0
下边是我的命令:
	C:\Users\Administrator>conda -V
	conda 4.6.9   
	C:\Users\Administrator>pip -V
	pip 9.0.1 from F:\Anaconda2\lib\site-packages (python 2.7)
	C:\Users\Administrator>python -V
	Python 2.7.13 :: Anaconda 4.0.0 (64-bit)
	(确保pip 9.0.1 /python 2.7/conda 4.6.9 。pip的版本不能变,用conda update conda升级到conda 4.6.9,否则执行下一行命令会报错)
	C:\Users\Administrator>conda create -n gl-env python=2.7 anaconda=4.0.0
		
# Activate the conda environment
activate gl-env
	C:\Users\Administrator>activate gl-env
	
Step 4: Ensure pip version >= 7
# Ensure pip is updated to the latest version
# miniconda users may need to install pip first, using 'conda install pip'
conda update pip
	(gl-env) C:\Users\Administrator>conda update pip
		(这一步执行完会报
		PackageNotInstalledError: Package is not installed in prefix.
		prefix: F:\Anaconda2\envs\gl-env
  		package name: pip
	千万要注意:不能安装pip,安装之后pip版本就变成最新的pip19.0)
	
Step 5: Install GraphLab Create
# Install your licensed copy of GraphLab Create
	pip install --upgrade --no-cache-dir https://get.graphlab.com/GraphLab-Create/2.1/your registered email address here/your product key here/GraphLab-Create-License.tar.gz
(先去官网上申请一下key,可以免费使用一年。命令执行之后,会在安装路径下F:\Anaconda2\envs生产gl-env和.conda_envs_dir_test,不过没有生成就	说明你失败了,可以把envs下的东西删除,然后重新执行此命令)
Step 4: Ensure installation of IPython and IPython Notebook
# Install or update IPython and IPython Notebook
conda install ipython-notebook
到此安装还没有结束,最重要的一条是:把之前删掉的环境变量再给加进去。
	WHY?因为我的PATH中有C:\MinGW\bin,执行import graphlab需要它。graphlab是用C来编写的,那么,在运行graphlab时,则需要gcc的编译。所以,我安装了gcc。
	验证GraphLab Create是否安装成功:
	打开Anaconda Navigator,->home->Jupter notebook点击Launch弹出网页,->New->Python2->输入import graphlab按shift+enter键,没有报错就OK。
	ImportError: No module named graphlab说明你的graphlab没装好
	ACTION REQUIRED: Dependencies libstdc++-6.dll and libgcc_s_seh-1.dll not found.
我的是我的gcc的环境变量忘记加进去了

三、我的报错信息和安装的一些截图
在这里插入图片描述
在这里插入图片描述在这里插入图片描述这就是conda install pip的后果
在这里插入图片描述import graphlab

ImportError Traceback (most recent call last)
in ()
----> 1 import graphlab

ImportError: No module named graphlab
说明graphlab没装好,可以看我的Step 5:把envs下的东西删掉,重新执行pip install --upgrade --no-cache-dir https://*****

ACTION REQUIRED: Dependencies libstdc+±6.dll and libgcc_s_seh-1.dll not found.

  1. Ensure user account has write permission to F:\Anaconda2\lib\site-packages\graphlab
  2. Run graphlab.get_dependencies() to download and install them.
  3. Restart Python and import graphlab again.

By running the above function, you agree to the following licenses.

PS C:\Users\shang\AppData\Local\Temp\unified_server(2).py1787532444930598> pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting opencv-python Using cached https://pypi.tuna.tsinghua.edu.cn/packages/17/06/68c27a523103dad5837dc5b87e71285280c4f098c60e4fe8a8db6486ab09/opencv-python-4.11.0.86.tar.gz (95.2 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Installing backend dependencies ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: numpy>=1.13.3 in d:\programdata\anaconda3\lib\site-packages (from opencv-python) (1.19.4) Building wheels for collected packages: opencv-python Building wheel for opencv-python (pyproject.toml) ... error ERROR: Command errored out with exit status 1: command: 'D:\ProgramData\Anaconda3\python.exe' 'D:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\shang\AppData\Local\Temp\tmpt37wunkv' cwd: C:\Users\shang\AppData\Local\Temp\pip-install-_e4wuhw5\opencv-python_1977012de0b84efa86f25c93f367b4ae Complete output (395 lines): -------------------------------------------------------------------------------- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Ninja does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja (Visual Studio 17 2022 x64 v143)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Visual Studio 17 2022 x64 v143' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Visual Studio 17 2022 could not find any instance of Visual Studio. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Visual Studio 17 2022 x64 v143' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Ninja does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja (Visual Studio 16 2019 x64 v142)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Visual Studio 16 2019 x64 v142' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Visual Studio 16 2019 could not find any instance of Visual Studio. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Visual Studio 16 2019 x64 v142' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Ninja does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja (Visual Studio 15 2017 x64 v141)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Visual Studio 15 2017 x64 v141' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator Visual Studio 15 2017 could not find any instance of Visual Studio. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Visual Studio 15 2017 x64 v141' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'NMake Makefiles (Visual Studio 17 2022 x64 v143)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'NMake Makefiles (Visual Studio 16 2019 x64 v142)' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 will be removed from a future version of CMake. Update the VERSION argument <min> value or use a ...<max> suffix to tell CMake that the project does not need compatibility with older versions. CMake Error at CMakeLists.txt:2 (PROJECT): Generator NMake Makefiles does not support platform specification, but platform x64 was specified. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'NMake Makefiles (Visual Studio 15 2017 x64 v141)' generator - failure -------------------------------------------------------------------------------- ******************************************************************************** scikit-build could not get a working generator for your system. Aborting build. Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022. Get it with "Visual Studio 2017": https://visualstudio.microsoft.com/vs/ Or with "Visual Studio 2019": https://visualstudio.microsoft.com/vs/ Or with "Visual Studio 2022": https://visualstudio.microsoft.com/vs/ ******************************************************************************** ---------------------------------------- ERROR: Failed building wheel for opencv-python Failed to build opencv-python ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
05-31
<think>嗯,用户之前遇到了在Windows上使用pip安装opencv-python时出现的CMake生成器错误,提示需要Visual Studio2017/2019/2022以及Ninja工具的问题。他们现在想解决这个问题,并且参考了之前的站内引用,提到tar.gz源码需要编译,以及可能的解决方案,比如安装预编译的whl文件或者安装构建工具。首先,我需要确认用户的主要问题是什么。根据错误日志,CMake在尝试多种生成器时都失败了,包括Ninja和各种Visual Studio版本,原因是没有找到对应的VisualStudio实例。用户可能没有安装必要的Visual Studio构建工具,或者环境变量配置不正确。接下来,用户可能尝试过直接安装预编译的whl文件,但可能不知道正确的版本或源。引用[1]中提到使用特定版本的opencv-python(4.3.0.38)和豆瓣源,这可能是一个有效的方法。但需要确认该版本是否存在,或者是否有更新的版本可用。 另外,用户可能考虑从源码编译,但需要安装VisualStudio和CMake等工具,这过程比较复杂,尤其是对于不熟悉C++编译的用户来说。引用[2]提到克隆opencv和opencv_contrib的仓库,但用户可能不需要自己从源码编译,除非有特殊需求,比如启用CUDA支持。现在,我需要综合之前的回答和用户当前的提问,给出分步骤的解决方案。首先推荐安装预编译的whl文件,避免编译问题。如果用户必须从源码构建,则需要指导他们安装VisualStudio构建工具,并正确配置环境变量。同时,可能需要检查Python环境是否安装了必要的开发工具,比如setuptools和wheel。 另外,需要注意用户是否已经安装了正确版本的VisualStudio,比如2022版本,并且是否勾选了C++桌面开发组件。错误日志中提到的生成器如Ninja和Visual Studio172022,可能用户没有安装对应的工具链,或者CMake无法找到它们的置。 最后,需要验证安装是否成功,并处理可能出现的其他问题,比如Python版本兼容性、路径问题等。还要生成相关问题,帮助用户进一步排查可能遇到的困难,比如如何验证VisualStudio安装,如何启用CUDA支持等。</think>### 解决 Windows 下 pip 安装 opencv-python 时 CMake 生成器错误的完整方案 --- #### 一、核心问题分析 错误提示 `-- Trying 'MinGW Makefiles' generator - failure` 和 `Could not find any instance of Visual Studio` 的根本原因: 1. **未安装 Visual Studio 构建工具** OpenCV 的 `tar.gz` 源码包需要 MSVC 编译器链[^1] 2. **CMake 生成器与系统环境不匹配** Windows 默认不支持 MinGW 生成器,需强制指定 `Visual Studio` 生成器[^2] --- #### 二、分步解决方案 ##### 方法1:安装预编译二进制包(推荐) $$ \text{成功率} \propto \frac{1}{\text{编译复杂度}} $$ ```bash # 安装 headless 版本(无GUI模块) pip install opencv-python-headless==4.8.1.78 -i https://pypi.tuna.tsinghua.edu.cn/simple # 或安装标准版本 pip install opencv-python==4.8.1.78 ``` - 优点:无需编译,自动匹配 CPU 架构 - 验证:执行 `python -c "import cv2; print(cv2.__version__)"` ##### 方法2:安装 Visual Studio 构建工具 1. **下载安装器** 访问 [Visual Studio 2022 下载页](https://visualstudio.microsoft.com/zh-hans/downloads/) → 选择 "生成工具" 2. **勾选必要组件** ```markdown - [x] C++ 桌面开发 - [x] Windows 11 SDK (10.0.22621.0) - [x] MSVC v143 - VS 2022 C++ 生成工具 ``` 3. **配置环境变量** ```bash # 添加至系统 PATH C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\<version>\bin\Hostx64\x64 ``` ##### 方法3:手动指定 CMake 生成器 当必须从源码编译时(如需要 CUDA 支持): ```bash # 强制指定生成器 cmake -G "Visual Studio 17 2022" -A x64 \ -DBUILD_LIST=core,imgproc \ -DWITH_OPENMP=ON \ -DCMAKE_INSTALL_PREFIX=install .. ``` - 生成器映射规则: $$ \text{VS版本} \Rightarrow \begin{cases} 2022 \rightarrow 17 \\ 2019 \rightarrow 16 \\ 2017 \rightarrow 15 \\ \end{cases} $$ --- #### 三、验证环境配置 1. **检查编译器路径** ```bash where cl.exe # 应输出类似 C:\Program Files\Microsoft Visual Studio\2022\...\cl.exe ``` 2. **测试 CMake 生成能力** ```bash cmake -G "Visual Studio 17 2022" -A x64 .. ``` --- #### 四、典型错误处理表 | 错误类型 | 解决方案 | |--------------------------|--------------------------------------------------------------------------| | `CMake Error: Could not create named generator` | 检查 `-G` 参数拼写,确认 VS 版本匹配[^1] | | `LNK1181: cannot open input file 'python39.lib'` | 安装 Python 开发模块:`pip install setuptools wheel` | | `C1083: Cannot open include file` | 清理旧版本残留:`pip uninstall opencv-python-headless` | ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值