我已将 Python 嵌入到应用程序中,foo.exe. 当它运行时,Python 被调用并立即查找Lib. 我可以让它工作的唯一方法是将Lib(Python 的模块目录库)放在foo.exe.
有没有办法可以将Python重定向到其他地方,例如Python/Lib?我无法更改PATH(这是 Windows)并且我不想破解 Python 源代码。
基本上,我无法让 Py_SetPath() 工作,并且我无法在互联网上找到任何实际示例。
更新:
好的,这有效:
#define MYMAXPATHLEN 1000
static wchar_t progpath[MYMAXPATHLEN + 1];
wchar_t* pdir = L"\\My_New_Location\\Python\\Lib";
wchar_t* pdelim = L";";
wchar_t* pypath = NULL;
GetModuleFileNameW(NULL, progpath, MYMAXPATHLEN);
reduce(progpath);
wcscat(progpath,pdir);
// I get the present module path and add the extra dirs to access Lib code
wcscat(progpath, pdelim); // I add a path delimiter
pypath = Py_GetPath(); …Run Code Online (Sandbox Code Playgroud) 在我的角度体验中,我被迫使用四种不同的方式包括第三方库poliglot.js(用于multilang).
所以能new Polyglot(...)在我的Lang课程中使用:
export class Lang
{
...
constructor() {
this.polyglot = new Polyglot({ locale: 'en' });
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
我用这四种方法
A.在我很老的(2016)angular2(基于framerwork angular2-webpack-starter)项目中(目前这个解决方案由于缺乏require新角度项目的指令而无效):
var Polyglot = require('../../../node_modules/node-polyglot/build/polyglot.min.js');
Run Code Online (Sandbox Code Playgroud)
B.在我的下一个项目angular4(基于angular2-webpack-starter):
import Polyglot from '../../../node_modules/node-polyglot/build/polyglot.min.js';
Run Code Online (Sandbox Code Playgroud)
C.在我最近在Laravel项目中嵌入的angular5项目(基于angular-cli)
import * as Polyglot from '../../../node_modules/node-polyglot/build/polyglot.min.js';
Run Code Online (Sandbox Code Playgroud)
D.我还发现了第4个解决方案,它适用于我的jQuery旧角度项目(基于angular2-webpack-starter)(并且互联网上的人们提到了很多这个解决方案)但我使用Polyglot示例写下来:
import '../../../node_modules/node-polyglot/build/polyglot.min.js';
declare var Polyglot: any;
// declare var $:any // this is for jquery (as example)
Run Code Online (Sandbox Code Playgroud)
问题是:这四种解决方案之间的区别是什么?是什么原因导致在某个项目中一个解决方案有效但其他解决方案无效
我正在尝试使用 Bintray 将库发布到 JCenter,根据这篇文章:https ://medium.com/@anitaa_1990/6-easy-steps-to-upload-your-android-library-to-bintray-jcenter- 59e6030c8890。
我成功地将库添加到Bintray,但是当我单击“添加到 JCenter ”按钮并发送撰写消息时 - 我收到一个错误:
无法发送消息:包应包含源作为包的一部分。
请告诉我我做错了什么?
我正在使用 CMake-3.13.4 和 KDevelop-5.2.1。
我有一个最顶层的 CMakeLists.txt,它定义了我的目标的版本号。看起来像:
set( PROJECT_VERSION_MAJOR 1 )
set( PROJECT_VERSION_MINOR 4 )
set( PROJECT_VERSION_PATCH 7 )
...
add_executable( mytarget main.cpp XXX.cpp ... )
target_link_libraries( mytarget "stdc++fs" ${CMAKE_THREAD_LIBS_INIT} ... )
install( TARGETS mytarget RUNTIME DESTINATION . )
Run Code Online (Sandbox Code Playgroud)
我希望 CMake 自动将版本字符串附加到目标的文件名中。所以我的代码如下:
install( TARGETS mytarget RUNTIME DESTINATION . RENAME "mytarget-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" )
Run Code Online (Sandbox Code Playgroud)
但这不起作用。
有没有办法用CMake来完成?我最终想要的文件名是“mytarget-1.4.7”。
我正在尝试从名为 的小型 cc (tcc-0.9.26-win64-bin.zip)运行该示例libtcc_test.c。
我已将libtcc.hfrom libtccintoinclude复制libtcc.def到lib.
然后我运行tcc ./examples/libtcc_test.c并收到链接错误:/
tcc: error: undefined symbol 'tcc_new'
tcc: error: undefined symbol 'tcc_set_lib_path'
tcc: error: undefined symbol 'tcc_set_output_type'
tcc: error: undefined symbol 'tcc_compile_string'
tcc: error: undefined symbol 'tcc_add_symbol'
tcc: error: undefined symbol 'tcc_relocate'
tcc: error: undefined symbol 'tcc_get_symbol'
tcc: error: undefined symbol 'tcc_delete'
Run Code Online (Sandbox Code Playgroud)
我缺少什么?
更多信息:
P:\cpp\tcc>tcc ./examples/libtcc_test.c -vv
tcc version 0.9.26 (i386 Win32)
-> ./examples/libtcc_test.c
-> p:/cpp/tcc/include/stdlib.h
-> p:/cpp/tcc/include/_mingw.h
-> …Run Code Online (Sandbox Code Playgroud) 尝试在Alpine上安装GCC 6.4.0时,我遇到了:
checking for the correct version of gmp.h... yes
checking for the correct version of mpfr.h... yes
checking for the correct version of mpc.h... yes
checking for the correct version of the gmp/mpfr/mpc libraries... no
Run Code Online (Sandbox Code Playgroud)
但是在中/usr/lib,这似乎是标准的查找目录,我有:
libgmp.a
libgmp.so
libgmp.so.10
libgmp.so.10.3.2
libmpc.so.3
libmpc.so.3.0.0
libmpfr.so.4
libmpfr.so.4.1.5
Run Code Online (Sandbox Code Playgroud)
有什么事吗
我的目标是在 Visual Studio 中使用 Rest API。我从https://github.com/Microsoft/vcpkg下载了 C++ 工具 vcpkg并按照https://github.com/Microsoft/cpprestsdk上的说明安装了 cpprestsdk。那工作得很好。
然后,在 Visual Studio 的解决方案资源管理器的属性中,我将 vcpkg 文件夹中的以下路径包含到“VCC++ 目录->包含目录”中:
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\cpprest
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\pplx
然后我运行我的代码并出现以下错误:
LNK2001 unresolved external symbols (32个这样的错误)
我用谷歌搜索并被告知将相应的“.lib”文件包含到“属性->链接器->输入->附加依赖项”中,并将相应的“.dll”文件的路径包含到“属性->链接器”中->General->Additional Library Directories”,我所做的。
现在,再次运行代码,只出现以下错误:
code execution cannot proceed because cpprest_2_10.dll was not found. Reinstalling the program may fix the problem,
尽管“cpprest_2_10.dll”在我之前包含的路径中。
我不知道问题是什么。提前感谢您的时间。
我编译了一个X.exe与动态库链接的组件(比方说Y.dll).X并Y已被释放.
现在我对一个对象的函数做了一个小改动,它Y保持着:我已经delete泄漏了对象并做了它的指针NULL.
要完全兼容地应用此更改,我该怎么办?
需要X使用新的库文件重新编译组件,并且还需要替换DLL;
X用新库文件重新编译就足够了;
更换DLL就足够了.
Android Studio版本3.2(AI-181.5540.7.32.5014246)。
在Android Studio 3.1中,我能够成功构建SignedAPK。但是,一旦我制作了Android Studio 3.2,我就根本无法构建SignedAPK。
这个问题是什么原因造成的?
我尚未编写将commons-io置于lib下的路径。
错误如下:
File 'root/lib/commons-io-2.4.jar' uses reserved file or directory name 'lib'.
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:packageReleaseBundle'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597)
at …Run Code Online (Sandbox Code Playgroud) 我找到了Xades Signature for Python GitHub。我的计划是将 Xades-EPES 签名应用于 XML 文件。根据 GitHub 的工作,它能够执行此过程,但我无法运行此过程。
test_xades.py有两种方法。当我尝试运行它时收到一条错误消息。好吧,问题是我不确定该库是否可以签署 Xades-EPES 或如何实现它。
先感谢您
代码:
import unittest
from datetime import datetime
from os import path
from OpenSSL import crypto
import xmlsig
from xades import XAdESContext, template, utils, ObjectIdentifier
from xades.policy import GenericPolicyId, ImpliedPolicy
from basex import parse_xml, BASE_DIR
class TestXadesSignature(unittest.TestCase):
def test_verify(self):
root = parse_xml('data/sample.xml')
sign = root.xpath(
'//ds:Signature', namespaces={'ds': xmlsig.constants.DSigNs}
)[0]
ctx = XAdESContext()
ctx.verify(sign)
def test_sign(self):
root = parse_xml('data/unsigned-sample.xml')
sign = root.xpath(
'//ds:Signature', namespaces={'ds': …Run Code Online (Sandbox Code Playgroud) lib ×10
android ×2
c++ ×2
dll ×2
python ×2
alpine-linux ×1
angular ×1
bintray ×1
c ×1
cmake ×1
cryptography ×1
dllimport ×1
gcc ×1
gmp ×1
installation ×1
java ×1
javascript ×1
jcenter ×1
kdevelop ×1
linux ×1
python-3.x ×1
tcc ×1
typescript ×1
version ×1
windows ×1