本文介绍了在Windows上为Python安装SimpleElastix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

似乎有人在GitHub上报告了此问题,但我仍然找不到一个明确的解决方案-在Windows上安装python模块的最后一步中,没有这样的文件夹,名为"/Wrapping/Python/Packaging"在"SimpleITK-build"下,其中没有名为"setup.py"的文件.人们指出,这可能是由于不正确的Python路径引起的问题.我尝试将Anaconda下的Python路径添加到系统中,以便可以通过cmd对其进行访问,但是并不能解决问题.然后,我卸载了Anaconda,重新安装了单独的Python,并向系统中添加了Python Path,但它也不能解决问题.有人可以分享一些有关如何解决此问题的经验吗?非常感谢您的帮助.

It seems some people have reported this on GitHub but I still couldn't find a clear solution to it - in the last step of installing the python module on Windows, there is no such folder called "/Wrapping/Python/Packaging" under "SimpleITK-build", and no file called "setup.py" in it. People have pointed out that it may be an issue coming from the improper Python Path. I tried adding Python Path under Anaconda to the system so that it can be accessed through cmd, but it didn't solve the problem. Then I uninstalled Anaconda, re-installed a separate Python and added Python Path to the system, and it didn't solve the problem, either. Could someone share some experience on how to solve this? I would appreciate your help.

灵花

下面是CMakeCacheInit文件:

Below is the CMakeCacheInit file:


set( PYTHON_VIRTUALENV_SCRIPT "D:/SimpleElastix/virtualenv/virtualenv.py" CACHE "STRING" "" FORCE )
set( SimpleITK_4D_IMAGES "ON" CACHE "BOOL" "Add Image and I/O support for four spatial dimensions." FORCE )
  mark_as_advanced( SimpleITK_4D_IMAGES )
set( SimpleITK_GIT_PROTOCOL "https" CACHE "STRING" "If behind a firewall turn set this to 'https' or 'http'." FORCE )
  mark_as_advanced( SimpleITK_GIT_PROTOCOL )
  set_property(CACHE SimpleITK_GIT_PROTOCOL PROPERTY STRINGS "https;http;git")
set( SimpleITK_LUA_EXECUTABLE "D:/SimpleElastix/Lua/bin/lua" CACHE "STRING" "" FORCE )
set( SimpleITK_OPENMP "OFF" CACHE "BOOL" "If available, use OpenMP to speed up certain elastix computations." FORCE )
  mark_as_advanced( SimpleITK_OPENMP )
set( ExternalData_OBJECT_STORES "D:/SimpleElastix/ExternalData/Objects;/../.ExternalData" CACHE "STRING" "Semicolon-separated list of local directories holding data objects in the layout %(algo)/%(hash)." FORCE )
  mark_as_advanced( ExternalData_OBJECT_STORES )
set( CMAKE_BUILD_TYPE "Release" CACHE "STRING" "" FORCE )
set( CMAKE_MAKE_PROGRAM "C:/Program Files \(x86\)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe" CACHE "STRING" "" FORCE )
set( CMAKE_C_COMPILER "C:/Program Files \(x86\)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe" CACHE "STRING" "" FORCE )
set( CMAKE_C_FLAGS "/DWIN32 /D_WINDOWS /W3" CACHE "STRING" "Flags used by the C compiler during all build types." FORCE )
  mark_as_advanced( CMAKE_C_FLAGS )
set( CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1" CACHE "STRING" "Flags used by the C compiler during DEBUG builds." FORCE )
  mark_as_advanced( CMAKE_C_FLAGS_DEBUG )
set( CMAKE_C_FLAGS_MINSIZEREL "/MD /O1 /Ob1 /DNDEBUG" CACHE "STRING" "Flags used by the C compiler during MINSIZEREL builds." FORCE )
  mark_as_advanced( CMAKE_C_FLAGS_MINSIZEREL )
set( CMAKE_C_FLAGS_RELEASE "/MD /O2 /Ob2 /DNDEBUG" CACHE "STRING" "Flags used by the C compiler during RELEASE builds." FORCE )
  mark_as_advanced( CMAKE_C_FLAGS_RELEASE )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Zi /O2 /Ob1 /DNDEBUG" CACHE "STRING" "Flags used by the C compiler during RELWITHDEBINFO builds." FORCE )
  mark_as_advanced( CMAKE_C_FLAGS_RELWITHDEBINFO )
set( CMAKE_CXX_COMPILER "C:/Program Files \(x86\)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe" CACHE "STRING" "" FORCE )
set( CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /W3 /GR /EHsc" CACHE "STRING" "Flags used by the CXX compiler during all build types." FORCE )
  mark_as_advanced( CMAKE_CXX_FLAGS )
set( CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1" CACHE "STRING" "Flags used by the CXX compiler during DEBUG builds." FORCE )
  mark_as_advanced( CMAKE_CXX_FLAGS_DEBUG )
set( CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1 /Ob1 /DNDEBUG" CACHE "STRING" "Flags used by the CXX compiler during MINSIZEREL builds." FORCE )
  mark_as_advanced( CMAKE_CXX_FLAGS_MINSIZEREL )
set( CMAKE_CXX_FLAGS_RELEASE "/MD /O2 /Ob2 /DNDEBUG" CACHE "STRING" "Flags used by the CXX compiler during RELEASE builds." FORCE )
  mark_as_advanced( CMAKE_CXX_FLAGS_RELEASE )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /O2 /Ob1 /DNDEBUG" CACHE "STRING" "Flags used by the CXX compiler during RELWITHDEBINFO builds." FORCE )
  mark_as_advanced( CMAKE_CXX_FLAGS_RELWITHDEBINFO )
set( CMAKE_LINKER "C:/Program Files \(x86\)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/link.exe" CACHE "FILEPATH" "Path to a program." FORCE )
  mark_as_advanced( CMAKE_LINKER )
set( CMAKE_EXE_LINKER_FLAGS "/machine:x64" CACHE "STRING" "Flags used by the linker during all build types." FORCE )
  mark_as_advanced( CMAKE_EXE_LINKER_FLAGS )
set( CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during DEBUG builds." FORCE )
  mark_as_advanced( CMAKE_EXE_LINKER_FLAGS_DEBUG )
set( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during MINSIZEREL builds." FORCE )
  mark_as_advanced( CMAKE_EXE_LINKER_FLAGS_MINSIZEREL )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during RELEASE builds." FORCE )
  mark_as_advanced( CMAKE_EXE_LINKER_FLAGS_RELEASE )
set( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/debug /INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during RELWITHDEBINFO builds." FORCE )
  mark_as_advanced( CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO )
set( CMAKE_MODULE_LINKER_FLAGS "/machine:x64" CACHE "STRING" "Flags used by the linker during the creation of modules during all build types." FORCE )
  mark_as_advanced( CMAKE_MODULE_LINKER_FLAGS )
set( CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of modules during DEBUG builds." FORCE )
  mark_as_advanced( CMAKE_MODULE_LINKER_FLAGS_DEBUG )
set( CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL "/INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of modules during MINSIZEREL builds." FORCE )
  mark_as_advanced( CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL )
set( CMAKE_MODULE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of modules during RELEASE builds." FORCE )
  mark_as_advanced( CMAKE_MODULE_LINKER_FLAGS_RELEASE )
set( CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "/debug /INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds." FORCE )
  mark_as_advanced( CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO )
set( CMAKE_SHARED_LINKER_FLAGS "/machine:x64" CACHE "STRING" "Flags used by the linker during the creation of shared libraries during all build types." FORCE )
  mark_as_advanced( CMAKE_SHARED_LINKER_FLAGS )
set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of shared libraries during DEBUG builds." FORCE )
  mark_as_advanced( CMAKE_SHARED_LINKER_FLAGS_DEBUG )
set( CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "/INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds." FORCE )
  mark_as_advanced( CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL )
set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of shared libraries during RELEASE builds." FORCE )
  mark_as_advanced( CMAKE_SHARED_LINKER_FLAGS_RELEASE )
set( CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "/debug /INCREMENTAL:NO" CACHE "STRING" "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds." FORCE )
  mark_as_advanced( CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO )
set( CMAKE_DL_LIBS "" CACHE "STRING" "" FORCE )
set( CMAKE_SYSTEM_PREFIX_PATH "C:/Program Files;C:/Program Files \(x86\);C:/Program Files/CMake;D:/SimpleElastix" CACHE "STRING" "" FORCE )
set( CMAKE_SYSTEM_LIBRARY_PATH "D:/SimpleElastix/bin;C:/Program Files/CMake/bin;/bin" CACHE "STRING" "" FORCE )
set( CMAKE_GENERATOR "Visual Studio 16 2019" CACHE "INTERNAL" "Name of generator." FORCE )
set( CMAKE_EXTRA_GENERATOR "" CACHE "INTERNAL" "Name of external makefile project generator." FORCE )
set( SITE "NoSiteGiven" CACHE "STRING" "" FORCE )
set( BUILDNAME "NoBuldNameGiven" CACHE "STRING" "" FORCE )

set( PYTHON_DEBUG_LIBRARY "PYTHON_DEBUG_LIBRARY-NOTFOUND" CACHE "FILEPATH" "Path to a library." FORCE )
  mark_as_advanced( PYTHON_DEBUG_LIBRARY )
set( PYTHON_EXECUTABLE "C:/Users/Linghua Zhang/AppData/Local/Programs/Python/Python37/python.exe" CACHE "FILEPATH" "Path to a program." FORCE )
  mark_as_advanced( PYTHON_EXECUTABLE )
set( PYTHON_LIBRARY "C:/Users/Linghua Zhang/AppData/Local/Programs/Python/Python37/libs/python37.lib" CACHE "FILEPATH" "Path to a library." FORCE )
  mark_as_advanced( PYTHON_LIBRARY )
set( PYTHON_INCLUDE_DIR "C:/Users/Linghua Zhang/AppData/Local/Programs/Python/Python37/include" CACHE "PATH" "Path to a file." FORCE )
  mark_as_advanced( PYTHON_INCLUDE_DIR )

推荐答案

我通过以下操作解决了这个问题:

I solved this by doing the following:

  1. 重新安装Anaconda3,在安装时添加到PATH(尽管安装程序不建议这样做).通过签入cmd,确保系统可以访问Python.只需键入"python",然后查看其版本是否弹出.
  2. 确保文件夹名称不像我一样包含任何空格("),尤其是对于Windows用户;如果确实有空间,请选择名称不带空格的另一个文件夹.
  3. 运行CMake并生成" python文件.构建过程需要1个小时以上的时间,并且应该以成功通知告终.
  4. "> https://github.com/SuperElastix/SimpleElastix/issues/233
  5. 打开Anaconda Navigator,然后打开VS的x64本机工具命令提示符,并按照 https://simpleelastix.readthedocs.io/GettingStarted.html

希望对遇到相同问题的其他人有帮助!

Hope it is helpful to others who meet the same problem!

这篇关于在Windows上为Python安装SimpleElastix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 20:41