- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想学习一些 lxml 和 pypy,所以我决定在我的 Yosemite Mac 上安装它。但经过三天的尝试,我仍然无法尝试 lxml,因为我无法正确设置。
这是我所做的:
是否安装了干净的homebrew
和xcode-select --install
proix:~ user$ brew --version
0.9.5
proix:~ user$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
编译了 libxml2
和 libxslt
- libxml2 代码 tar 3.4.1 和 libxslt 代码 tar 1.1.28;工作得很好。库已构建并安装。
proix:~ user$ brew list
libxml2 libxslt
proix:~ user$ brew info
2 kegs, 409 files, 14M
proix:~ user$ ll /usr/local/Cellar/libxml2/2.9.2/lib/
total 6096
drwxr-xr-x 8 user admin 272 27 Dez 11:46 .
drwxr-xr-x 13 user admin 442 27 Dez 11:46 ..
drwxr-xr-x 3 user admin 102 27 Dez 11:46 cmake
-r--r--r-- 1 user admin 1184284 27 Dez 11:46 libxml2.2.dylib
-r--r--r-- 1 user admin 1922024 27 Dez 11:46 libxml2.a
lrwxr-xr-x 1 user admin 15 27 Dez 11:46 libxml2.dylib -> libxml2.2.dylib
drwxr-xr-x 3 user admin 102 27 Dez 11:46 pkgconfig
-r--r--r-- 1 user admin 269 27 Dez 11:46 xml2Conf.sh
proix:~ user$ ll /usr/local/Cellar/libxslt/1.1.28/lib/
total 1440
drwxr-xr-x 10 user admin 340 27 Dez 12:10 .
drwxr-xr-x 13 user admin 442 27 Dez 12:10 ..
-r--r--r-- 1 user admin 76728 27 Dez 12:10 libexslt.0.dylib
-r--r--r-- 1 user admin 101832 27 Dez 12:10 libexslt.a
lrwxr-xr-x 1 user admin 16 27 Dez 12:10 libexslt.dylib -> libexslt.0.dylib
-r--r--r-- 1 user admin 214344 27 Dez 12:10 libxslt.1.dylib
-r--r--r-- 1 user admin 326040 27 Dez 12:10 libxslt.a
lrwxr-xr-x 1 user admin 15 27 Dez 12:10 libxslt.dylib -> libxslt.1.dylib
drwxr-xr-x 4 user admin 136 27 Dez 12:10 pkgconfig
-r--r--r-- 1 user admin 288 27 Dez 12:10 xsltConf.sh
但是这些新版本并未被使用:
$ xmllint --version
xmllint: using libxml version 20900
因此,我通过恢复控制台(启动期间 cmd+R)切换了 /usr/lib
下的库。重新启动后,我得到了预期的结果:
$ xmllint --version
xmllint: using libxml version 20902`
警告!不要尝试在正常登录 session 期间执行此操作。如果操作系统无法再找到 libxml2.dylib
,它会让您的系统完全无用。
创建一个用于测试的 virtualenv:
virtualenv lxmllab
source lxmllab/bin/activate`
使用STATIC_DEPS=true sudo pip install lxml
安装lxml。效果也很好:
(lxmllab)proix:~ user$ pip list
backports.ssl-match-hostname (3.4.0.2)
certifi (14.5.14)
cffi (0.6)
docutils (0.12)
ipython (2.3.1)
Jinja2 (2.7.3)
lxml (3.4.1)
MarkupSafe (0.23)
nose (1.3.4)
numpydoc (0.5)
pip (6.0.3)
py (1.4.26)
Pygments (2.0.1)
pyzmq (14.4.1)
setuptools (8.2.1)
Sphinx (1.2.3)
tornado (4.0.2)
测试一下:
(lxmllab)proix:~ user$ pypy -c 'from lxml import etree'
Unknown libxml2 version: 20902
Traceback (most recent call last):
File "app_main.py", line 72, in run_toplevel
File "app_main.py", line 562, in run_it
File "<string>", line 1, in <module>
File "lxml.etree.pyx", line 270, in init lxml.etree (src/lxml/lxml.etree.c:199039)
File "lxml.etree.pyx", line 235, in lxml.etree.__unpackDottedVersion (src/lxml/lxml.etree.c:9383)
TypeError: unsupported operand type for int(): 'unicode'
(lxmllab)proix:~ user$ pypy
Python 2.7.3 (5acfe049a5b0, May 21 2013, 13:47:22)
[PyPy 2.0.2 with GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``redefining yellow seems like a
better idea''
---- from lxml import etree
Unknown libxml2 version: 20902
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "lxml.etree.pyx", line 270, in init lxml.etree (src/lxml/lxml.etree.c:199039)
File "lxml.etree.pyx", line 235, in lxml.etree.__unpackDottedVersion (src/lxml/lxml.etree.c:9383)
TypeError: unsupported operand type for int(): 'unicode'
----
这就是我陷入困境的地方。我尝试了一些修复,但没有成功:
LD_LIBRARY_PATH
和/或 DYLD_LIBRARY_PATH
设置为 libxml2 的位置。site-packages/lxml
文件夹。有谁知道我应该做什么才能让它工作,或者让 lxml 库在 Yosemite 下工作的正确方法是什么?
最佳答案
PyPy 不能与 lxml 一起使用(至少不是很好,即使它意外地可以),因为 lxml 是在使用 CPython C API 绑定(bind)的 Cython 之上构建的。考虑使用 lxml-cffi 代替 https://github.com/amauryfa/lxml/tree/cffi
关于python - 如何在 Yosemite 上设置 lxml 和 pypy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27675625/
在 Yosemite 中启用深色模式时,必须更改状态栏应用程序图标。如何检测深色模式是否开启?有同样的通知吗? 显示另一张图像或更改现有图像的 alpha 值是否更好?需要了解哪种方法更好? 最佳答案
我刚刚更新到优胜美地,但我不断收到来自 drush 的错误消息。 dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.53.dy
设置类似于 this post 的本地开发环境一切正常,但最近我离线时无法访问我的本地开发域。当我连接到互联网时,它工作正常。我想知道优胜美地中解析器的使用方式是否有所改变。如果我离线,似乎解析器规则
自安装优胜美地以来,我不断收到错误 SSL:CA 证书设置,但证书验证已禁用。它出现在终端中的每个 https url 中。 找不到如何解决这个问题,有什么建议吗? 谢谢 坦率 最佳答案 对于来到这里
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我的电脑里有很多excel文件,它们的图标都是普通纸,像这样: 我希望所有图标都是 .numbers 图标。有谁知道怎么做? 最佳答案 这是你可以做的: 打开 Finder 窗口并导航到/Applic
有很多人遇到类似的问题,过去我在其他计算机上曾经是其中之一,而且那里的解决方案似乎都不起作用-与其他遇到类似问题的人相比,我似乎也有不同的错误: Building native extensions.
我今天刚升级到优胜美地。我已经很久没有 mac 了。但是随着更新,我的本地主机不起作用。 Chrome 返回此网页不可用。我试过了 sudo apachectl start 尝试取回它,但没有成功。我
在升级到 Yosemite 之前,我之前已经在 mac 上安装了 Cloud Code 工具。现在使用以下命令安装时 curl -s https://www.parse.com/downloads/c
有什么方法可以删除我的 Cocoa 应用程序中的 Mac OS Yosemite 透明度吗?在 NSWindow 或 NSToolbar 中没有找到任何相关设置。 最佳答案 NSWindow 采用 N
我正在尝试使用命令行打开禁用安全性的 google chrome mac open -a Google\ Chrome --args --disable-web-security 但是,它不断打开并行
在尝试启动并运行我的新 Yosemite 机器时,我在安装 HomeBrew 和 MacPorts 时发现此错误。 Library not loaded: /usr/local/lib/libcurl
我刚试过这个,但我收到了这个错误信息。关于如何修复它的任何想法?我使用的是 R 版本 3.1.1,RNetLogo_1.0-1,平台是 x86_64-apple-darwin13.1.0(64 位),
我正在尝试签署内核扩展文件“abc.kext”。我有一个启用了 kext 的证书并尝试使用以下方式签署我的“abc.kext”: codesign --sign "Developer ID Appli
在 Yosemite 中修改 PATH 等环境变量的正确方法是什么? 这是这个问题Setting environment variables in OS X?但特别适用于优胜美地,因为它不再有效。 最
我们可以使用 JavaScript 将点击事件发送到 Cocoa 应用程序中 Web View 内的按钮吗? 我尝试使用实用程序(Yosemite)下的脚本编辑器来记录,但不幸的是无法记录 WebVi
我已经更新到 OS X Yosemite。当运行任何与远程仓库有关的 git 命令(pull、fetch 等)时,终端会不断询问我的 github 用户名和密码(远程在 github 上)。如果我从适
实际上它可以正常登录,当我使用 sudo 执行某些操作时也是如此。但是当我尝试更改首选项并弹出带有登录名/密码的窗口时,它说密码不正确。 所以我实际上无法安装任何东西。 最佳答案 我终于解决了这个问题
我想在系统首选项中的桌面和屏幕保护程序设置的复选框之后设置启动时间。但我想从我的命令石灰中做到这一点。更改 com.apple.screensaver.plist 的值对我没有帮助。感谢您的帮助。 最
我安装了 Yosemite,现在当我使用 MAMP 时收到这个 fatal error : Fatal error: Uncaught exception 'PDOException' with me
我是一名优秀的程序员,十分优秀!