相关疑难解决方法(0)

使用ctypes(python)在带括号的路径中加载dll时出错

我正在尝试访问位于64位处理器PC中"c:/ Program Files(x86)"文件夹中的dll.

如果我使用os.path.exists来检查dll是否存在,我会得到一个肯定的答案:

>>> print os.path.exists('c:/Program Files (x86)/Some Folder/SomeDll.dll')
True
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用ctypes加载dll时,我收到以下错误:

>>> from ctypes import WinDLL
>>> some_dll = WinDLL('c:/Program Files (x86)/Some Folder/SomeDLL.dll')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found
Run Code Online (Sandbox Code Playgroud)

在32位PC中,dll位于"c:/ Program Files"文件夹中,我可以毫无问题地打开它.我想也许问题是文件夹名称中是否存在括号.由于返回的异常是WindowsError,它似乎是负责加载库的操作系统函数中的一个缺陷.

所以,问题是:如何加载位于"c:/ Program Files(x86)"文件夹中的dll?我无法将dll复制到另一个目的地,它必须位于原始路径中...

谢谢!

python dll ctypes

5
推荐指数
1
解决办法
5528
查看次数

安装 Python geopandas 失败

我正在尝试安装 geopandas。进行以下设置:

  • 视窗-64
  • Anaconda2(64 位)
  • 蟒蛇 2.7

尝试了两件事:

1)

pip install geopandas
Run Code Online (Sandbox Code Playgroud)

这给了我以下错误:

WindowsError: [Error 126] The specified module could not be foundCommand "python setup.py egg_info" failed with error code 1 in c:\users\username\appdata\local\temp\pip-install-_kgeyw\shapely\

此处类似问题的解决方案表明,这是因为正在转换的路径中的斜线。不知道如何测试这个。

2)

anaconda search -t conda geopandas
Run Code Online (Sandbox Code Playgroud)

然后我搜索适合我的设置的 geopandas 版本(Windows-64):

conda install -c maxalbert geopandas
Run Code Online (Sandbox Code Playgroud)

这会产生以下错误:

UnsatisfiableError: The following specifications were found to be in conflict:
 - geopandas
Use "conda info <package> to see the dependencies for each package
Run Code Online (Sandbox Code Playgroud)

当我运行命令时,conda info geopandas我会得到一个 …

python pip anaconda geopandas

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

python ×2

anaconda ×1

ctypes ×1

dll ×1

geopandas ×1

pip ×1