我正在尝试关注 this tutorial关于为 Windows 的 python 包装 C++ 代码。我安装了 python。下载了最新版本的 boost(1_55)。首先我运行 bootstrap.bat 来构建 bjam.exe。接下来,我配置了 boost_1_55_0\tools\build\v2\user-config .jam 使用 msvc10 编译器并添加了 python 安装路径。 现在,基于教程:
Now we are ready... Be sure to cd to libs/python/example/tutorial where the tutorial "hello.cpp" and the "Jamroot" is situated.
Finally:
bjam
尝试在该目录中运行 bjam 时出现:“bjam 未被识别为内部或外部命令”错误。我在这里错过了什么? user-config.jam 应该驻留在另一个位置吗?还是将 bjam 添加到系统路径?
更新:
好的。感谢@john,我必须将 bjam 添加到系统路径。但是现在,运行它,hello_ext.lib 是在 \boost_1_55_0\libs\python\example\tutorial\bin\msvc-11.0\中创建的debug 但不是 DLL。根据教程,我应该获取扩展的 DLL 文件。现在,我不确定 python 如何与扩展链接。但如果我假设它确实像 C++,那么它应该与 hello_ext 链接。 lib.But 如果运行:
python hello.py
其中包含从扩展中导入的方法,python 运行时崩溃。没有关于此工作流程的综合教程吗?Boost 文档对此一无所知。
最佳答案
这对我有用:
1.) 解压缩 boost_1_55_0.zip
2.) 准备使用 Boost 库二进制文件
转到 boost_1_55_0 根目录并打开命令提示符并键入以下命令:
Bootstrap
3.) 找到 user-config.jam:
在命令提示符中键入以下内容:
ECHO %HOMEDRIVE%%HOMEPATH%
4.) 如果 user-config.jam 在你的 homedrive 目录中,请按如下所示更改它:
注意:
.jam 语言将“空格”视为参数的分隔!
# -------------------
# MSVC configuration.
# -------------------
# Configure msvc (default version, searched for in standard locations and PATH).
# using msvc ;
# Configure specific msvc version (searched for in standard locations and PATH).
using msvc : 10.0 : C:\\app\\tools\\MSVisualStudio2010\\VC\\bin\\cl.exe ;
….
# ---------------------
# Python configuration.
# ---------------------
# Configure specific Python version.
# using python : 3.1 : /usr/bin/python3 : /usr/include/python3.1 : /usr/lib ;
using python
: 2.5 # Version
: C:\\app\\tools\\Python25\\python.exe # Python Path
: C:\\app\\tools\\Python25\\include # include path
: C:\\app\\tools\\Python25\\libs # lib path(s)
: <define>BOOST_ALL_NO_LIB=1
;
5.) 配置后构建库!!
转到 boost_1_55_0 根目录并打开命令提示符并键入以下命令:
.\b2
6.) 将 user-config.jam 复制到\boost_1_55_0\libs\python\example\tutorial 7.) 进一步到\boost_1_55_0\stage\lib\
将libboost_python-vc100-mt-gd-1_55.lib重命名为boost_python-vc100-mt-gd-1_55.lib并复制到
\boost_1_55_0\libs\python\example\tutorial
8.) 现在您应该在\boost_1_55_0\libs\python\example\tutorial 目录中拥有所有这些文件
hello.cpp
hello.py
user-config.jam
Jamroot
boost_python-vc100-mt-gd-1_55.lib
bjam.exe
9.) 在\boost_1_55_0\libs\python\example\tutorial 中打开命令提示符
然后键入以下命令:
bjam
10.) 构建成功后..
你应该在目录中有这个文件:
hello_ext.dll
将此文件重命名为:
hello_ext.pyd
关于c++ - 无法运行bjam编译boost python教程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20093331/
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
我在从html页面生成PDF时遇到问题。我正在使用PDFkit。在安装它的过程中,我注意到我需要wkhtmltopdf。所以我也安装了它。我做了PDFkit的文档所说的一切......现在我在尝试加载PDF时遇到了这个错误。这里是错误:commandfailed:"/usr/local/bin/wkhtmltopdf""--margin-right""0.75in""--page-size""Letter""--margin-top""0.75in""--margin-bottom""0.75in""--encoding""UTF-8""--margin-left""0.75in""-
在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/
我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在
exe应该在我打开页面时运行。异步进程需要运行。有什么方法可以在ruby中使用两个参数异步运行exe吗?我已经尝试过ruby命令-system()、exec()但它正在等待过程完成。我需要用参数启动exe,无需等待进程完成是否有任何rubygems会支持我的问题? 最佳答案 您可以使用Process.spawn和Process.wait2:pid=Process.spawn'your.exe','--option'#Later...pid,status=Process.wait2pid您的程序将作为解释器的子进程执行。除
我尝试运行2.x应用程序。我使用rvm并为此应用程序设置其他版本的ruby:$rvmuseree-1.8.7-head我尝试运行服务器,然后出现很多错误:$script/serverNOTE:Gem.source_indexisdeprecated,useSpecification.Itwillberemovedonorafter2011-11-01.Gem.source_indexcalledfrom/Users/serg/rails_projects_terminal/work_proj/spohelp/config/../vendor/rails/railties/lib/r
我的瘦服务器配置了nginx,我的ROR应用程序正在它们上运行。在我发布代码更新时运行thinrestart会给我的应用程序带来一些停机时间。我试图弄清楚如何优雅地重启正在运行的Thin实例,但找不到好的解决方案。有没有人能做到这一点? 最佳答案 #Restartjustthethinserverdescribedbythatconfigsudothin-C/etc/thin/mysite.ymlrestartNginx将继续运行并代理请求。如果您将Nginx设置为使用多个上游服务器,例如server{listen80;server
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我花了三天的时间用头撞墙,试图弄清楚为什么简单的“rake”不能通过我的规范文件。如果您遇到这种情况:任何文件夹路径中都不要有空格!。严重地。事实上,从现在开始,您命名的任何内容都没有空格。这是我的控制台输出:(在/Users/*****/Desktop/LearningRuby/learn_ruby)$rake/Users/*******/Desktop/LearningRuby/learn_ruby/00_hello/hello_spec.rb:116:in`require':cannotloadsuchfile--hello(LoadError) 最佳
Sinatra新手;我正在运行一些rspec测试,但在日志中收到了一堆不需要的噪音。如何消除日志中过多的噪音?我仔细检查了环境是否设置为:test,这意味着记录器级别应设置为WARN而不是DEBUG。spec_helper:require"./app"require"sinatra"require"rspec"require"rack/test"require"database_cleaner"require"factory_girl"set:environment,:testFactoryGirl.definition_file_paths=%w{./factories./test/