facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

fatal error LNK1104: cannot open "python27.lib" #1657

Open LMerCy opened 6 years ago

LMerCy commented 6 years ago

If this is a build issue, please fill out the template below.

System information

CMake summary output

General: -- Git version : v0.8.1-877-g1bcd36d-dirty -- System : Windows -- C++ compiler : C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- C++ compiler version : 19.0.24215.1 -- Protobuf compiler : c:\caffe2\scripts..\build_host_protoc\bin\protoc.exe -- CXX flags : /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MP /bigobj -- Build type : Release -- Compile definitions :

-- BUILD_BINARY : ON -- BUILD_PYTHON : ON -- Python version : 2.7.14 -- Python library : C:/ProgramData/Anaconda2/libs/python27.lib -- BUILD_SHARED_LIBS : OFF -- BUILD_TEST : OFF -- USE_ATEN : OFF -- USE_ASAN : OFF -- USE_CUDA : OFF -- USE_EIGEN_FOR_BLAS : 1 -- USE_FFMPEG : OFF -- USE_GFLAGS : OFF -- USE_GLOG : OFF -- USE_GLOO : OFF -- USE_LEVELDB : OFF -- USE_LITE_PROTO : OFF -- USE_LMDB : OFF -- USE_METAL : OFF -- USE_MKL : -- USE_MOBILE_OPENGL : OFF -- USE_MPI : OFF -- USE_NCCL : OFF -- USE_NERVANA_GPU : OFF -- USE_NNPACK : OFF -- USE_OBSERVERS : ON -- USE_OPENCV : OFF -- USE_OPENMP : OFF -- USE_REDIS : OFF -- USE_ROCKSDB : OFF -- USE_THREADS : ON -- USE_ZMQ : OFF CMake Warning at CMakeLists.txt:159 (message): Generated cmake files are only fully tested if one builds with system glog, gflags, and protobuf.

CMake Warning at CMakeLists.txt:192 (message): Generated cmake files are only available when building shared libs.

**** Summary ****

``` “C:\caffe2\build\ALL_BUILD.vcxproj”(默认目标) (1) -> “C:\caffe2\build\caffe2\caffe2_pybind11_state.vcxproj”(默认目标) (8) -> (Link 目标) -> LINK : fatal error LNK1104: cannot open “python27.lib” [C:\caffe2\build\caffe2\caffe2_pybind11_state.vcxproj] ``` I have installed Anaconda2, and add envronment variables of python.exe for python27.lib, but when i run build_windows.bat , i still goes wrong with link error "fatal error LNK1104:cannot open python27.lib" 2017.12.25 I unistall anaconda2 and install python2.7.12, Microsoft Visual C++ Compiler for Python 2.7, but it still cannot work with the same error.
LMerCy commented 6 years ago

2017.12.25 I have finally solved the problem, Instead of building with build_windows.bat, i choose to build with caffe2.sln(vs2015), by this i find i haven't include python27.lib in caffe2 project. I think this is the reseason why i cannnot build first time.

FilipDepta commented 6 years ago

You've made my life easier LMerCy! It helps, i have put python27.lib into few project directories and built with build_windows.bat successfully.

For those who didn't know - first edit build_windows.bat file flag -DBUILD_PYTHON=ON.

qiuliwang commented 6 years ago

could you please tell me how to include python27.lib in caffe2?

FilipDepta commented 6 years ago

It was in few places: -(main directory) caffe2/ -(main directory) caffe2/build/ -(main directory) caffe2/build/caffe2

I'm not sure in which directory lib should be, so i put into all of them

BIGBALLON commented 6 years ago

Just copy python27.lib to -(main directory) caffe2/build/caffe2, it works.

e.g. (C:\pytorch\build\caffe2)

image

image