几天前我升级到了 El Capitan(版本 10.11 Beta 7,内部版本 15A263e)。除了权限问题外,一切似乎都运行正常。但是,当我尝试运行某些 Haxe 库或使用 Python 包管理器 pip 时,我收到与 相关的错误zlib
,我不知道如何解决。
当我尝试运行时出现 Haxe 错误haxelib run lime setup
,并收到以下信息:
Called from /usr/lib/haxe/std/neko/_std/haxe/zip/Compress.hx line 60
Uncaught exception - load.c(237) : Failed to load library : zlib.ndll (dlopen(zlib.ndll, 1): image not found)
当我尝试运行通过 Homebrew 安装的 pip 时,出现以下信息:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==7.1.2', 'console_scripts', 'pip')()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name) File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Python/2.7/site-packages/pip/__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/Library/Python/2.7/site-packages/pip/vcs/mercurial.py", line 10, in <module>
from pip.download import path_to_url
File "/Library/Python/2.7/site-packages/pip/download.py", line 38, in <module>
from pip._vendor import requests, six
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/__init__.py", line 58, in <module>
from . import utils
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/utils.py", line 26, in <module>
from .compat import parse_http_list as _parse_list_header
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/compat.py", line 7, in <module>
from .packages import chardet
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/__init__.py", line 3, in <module>
from . import urllib3
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 10, in <module>
from .connectionpool import (
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 38, in <module>
from .response import HTTPResponse
File "/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 5, in <module>
import zlib
ImportError: No module named zlib
这是除了 pip 的权限错误之外的问题;如果不使用,我就无法运行 pip sudo
,但我认为这可能无关。
有什么想法吗?我认为构建缺失的内容zlib.ndll
可能会解决该问题,但我不知道这样做的“正确”方法是什么。
答案1
Haxe 需要正确配置 neko 才能运行 haxelib 等工具。您可以通过以下方式安装 neko自制按照以下步骤操作。首先,您需要 zlib 和 sqlite,因为 neko 需要这两者。
brew install zlib sqlite3
现在您需要强制 Homebrew 链接这些,因为它们是仅限 keg 的库,并且 neko 需要 /usr/local/include 中的包含文件。
brew link zlib --force
brew link sqlite3 --force
最后,通过 Homebrew 安装 neko。确保还将 NEKOPATH 设置为创建的 homebrew 目录。
brew install neko --HEAD