Bad boundary python25 + vs2005 (2005 really spends the source Arab League.。。
had period of time not to write blog.How these are days all studying seal c++, enable python to be possible to use c++ the storehouse.Has discovered boost.python this on-line well thump.
has not bumped into a question in the use process.This culture and education everybody how
char const* greet(
{
return “hello, world”;
}
seals python.In fact this is inside the python course thump.
first downloads Boost,
www.boost.org .boost.python inside boost.In visual studio 2005 command prompt navigation to
boost boost_1_34_0 under.Remembered certainly must use visual studio 2005 command prompt this vs2005 belt tools, do not have to use cmd.exe, otherwise meets
to bump into very many wrong.Then is the bjam.exe copy to one can under the table of contents which found, or directly also copy to boost boost_1_34_0 under then.Then,
establishes python the root directory and the python edition, also may add to directly them in the bad boundary table of contents, such does not need each time all to establish.
set PYTHON_ROOT=c:/python25
set PYTHON_VERSION=2.5
then might move directly, bjam - the sTOOLS=vc-8_0
entire translation process had the very long time.。。After
success, can have many boost_python-vc80- **** .dll, .lib, their all copy to one can the table of contents which was found by the system, might as well directly throws their
all
under c:windowssystem32.
then, we start to translate hello.navigation to boost boost_1_34_0 libs python example tutorial under, bjam - sTOOLS=vc-8_0 moves
, namely can produce hello.pyd under the bin table of contents.Under this basically has succeeded, if does not have the success, whether check above boost_python these dll is the
series found.Moreover, here has python25 bug.。。I spent the very long time only then to find in python mail lists.Cold.。。
wrong as follows shows:
D:LearnPythonboostboost _1_34_0 libs python example tutorial> bjam
Jamroot:17: in modules.load
rule python-extension unknown in module Jamfile< /D: /Learn/Python/boost/boost_1_3
4_0/libs/python/example/tutorial>.
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2/build project.jam:312: in load
-jamfile
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2/build project.jam:68: in load
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2/build project.jam:170: in proj
ect.find
D:/Learn/Python/boost/boost_1_34_0/tools/build/v2 build-system.jam:237: in load
D:LearnPythonboostboost _1_34_0 libs python example . . . tools build v2/k
ernel modules.jam:261: in import
D:LearnPythonboostboost _1_34_0 libs python example . . . tools build v2/k
ernel/bootstrap.jam:132: in boost-build
D:LearnPythonboostboost _1_34_0 libs python example boost-build.jam:7: in mod
ule the scope
solution is as follows:
table of contents found the user-config.jam document in boost boost_1_34_0 tools build v2 under the , opens in
import toolset: using; Under
adds line of codes:
using python;
translates again boost, then did not have the question.Inside tutorial hello can translate smoothly passes.ps. this question has puzzled my quite long time.。sigh.。
.After
translates successfully can produce hello.pyd, under bin table of contents.
has many means to test this hello.pyd whether can use.The
method one, its copy to python25 dlls under, opens IDLE,
>>> import hello
>>> hello.greet(
'hello, world'
>>> The
method two, directly writes a python document under the current directory, then transfers hello.pyd directly then.In brief, hello.pyd was a python document.。Mmm
.Operates hello.pyd the root other python document is same.
like this succeeded.If
bumps into the following mistake, is because the system cannot find boost_python dll.The intense suggestion all throws them under system32! .
>>> import hello
Traceback (most recent call last:
File “<pyshell#0> “, line 1, in <module>
import hello
ImportError: DLL load failed: Cannot find module which assigns.
>>>
explained, hello.cpp in boost boost_1_34_0 libs python example under tutorial table of contents.The inside content is:
// Copyright Joel de Guzman 2002-2004. Distributed under the Boost
//Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt
//or copy at
http://www.boost.org/LICENSE_1_0.txt //Hello World Example from the tutorial
//[Joel de Guzman 10/9/2002]
char const* greet(
{
return “hello, world”;
}
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(hello
{
def (“greet”, greet;
}
BOOST_PYTHON_MODULE(hello
{
def (“greet”, greet;
}
is to greet from c++ to a python seal statement, the attire traded gives boost.