Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solutions to pycaffe LINK error :__imp__Py_NegativeRefcount, __imp__Py_Dealloc, __imp__Py_RefTotal #76

Open
zhouphd opened this issue Apr 24, 2016 · 0 comments

Comments

@zhouphd
Copy link

zhouphd commented Apr 24, 2016

When compile the project of pycaffe , I found errors on the output window:
15>_caffe.obj : error LNK2019: __imp__Py_NegativeRefcount
15>_caffe.obj : error LNK2019: __imp__Py_Dealloc
15>_caffe.obj : error LNK2001: __imp__Py_RefTotal
15>..\Build\x64\Debug_caffe.pyd : fatal error LNK1120:

These may be cause by the python config problem on windows, the solution is below:
Firstly, comment the define Py_DEBUG on pyconfig.h:
line 379 #ifdef _DEBUG
line 380 //# define Py_DEBUG
line 381 #endif

Change
line 338 # pragma comment(lib,"python27_d.lib")
into
line 338 # pragma comment(lib,"python27.lib")

Then, commment the line 56 on object.h
line 55 #if defined(Py_DEBUG) && !defined(Py_TRACE_REFS)
line 56 //#define Py_TRACE_REFS
line 57 #endif

pyconfig.h & object.h can be find at your $PythonHome/include directory
for Miniconda 2, it's C:\Miniconda2\include

Good luck, :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant