编辑:我遵循下面的Alistaire的建议,并使用pip安装了docker和numpy。
但是,在R中运行install_splash()时,这会产生一个新错误:
> install_splash()
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: module 'os' has no attribute 'errno'
3. stop(structure(list(message = "AttributeError: module 'os' has no
attribute 'errno'",
call = py_call_impl(callable, dots$args, dots$keywords),
cppstack = structure(list(file = "", line = -1L, stack = "C++ stack not available on this system"), class =
"Rcpp_stack_trace")), class = c("Rcpp::exception",
"C++Error", "error", "condition")))
2.client$api$pull("scrapinghub/splash", tag)
1.install_splash()
当我使用debug重新运行install_splash()时,收到以下消息:
Detailed traceback:
File "C:\Python37\lib\site-packages\docker\api\image.py", line 380, in pull
header = auth.get_config_header(self, registry)
File "C:\Python37\lib\site-packages\docker\auth.py", line 48, in get_config_header
client._auth_configs, registry, credstore_env=client.credstore_env
File "C:\Python37\lib\site-packages\docker\auth.py", line 96, in resolve_authconfig
authconfig, registry, store_name, env=credstore_env
File "C:\Python37\lib\site-packages\docker\auth.py", line 129, in _resolve_authconfig_credstore
data = store.get(registry)
File "C:\Python37\lib\site-packages\dockerpycreds\store.py", line 35, in get
data = self._execute('get', server)
File "C:\Python37\lib\site-packages\dockerpycreds\store.py", line 89, in _execute
if e.errno == os.errno.ENOENT:
有什么作用?我知道Splash已启动并正在运行,并且我已经使用pip freeze
确认了docker和numpy模块的正确安装。
原始帖子:
我正在尝试从R中的许多网站中刮除表格。为此,建议我通过Docker使用Splash。我已经下载了Docker,并设法使其启动并运行。另外,我已经安装了Python 3.5。我已经通过以下命令提取了Splash图片:
docker pull scrapinghub/splash
并通过以下命令启动容器:
docker run -p 8050:8050 -p 5023:5023 scrapinghub/splash
通过在浏览器中检查“ http://localhost:8050/”,我检查了Splash是否确实正常运行。
在R中,我运行以下命令:
> splash_active()
哪个返回此:
Status of splash instance on [http://localhost:8050]: ok. Max RSS: 73 Mb
[1] TRUE
到目前为止,一切都很好。现在,我正在尝试通过以下命令在R中安装Splash:
install_splash()
但是R返回一个错误,说:
Error: Python module docker was not found.
Detected Python configuration:
python: C:\Users\Lucas\AppData\Local\Programs\Python\Python37\\python.exe
libpython: C:/Users/Lucas/AppData/Local/Programs/Python/Python37/python37.dll
pythonhome: C:\Users\Lucas\AppData\Local\Programs\Python\Python37
version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
Architecture: 64bit
numpy: [NOT FOUND]
docker: [NOT FOUND]
可能是什么问题?是否与找不到“ numpy”和“ docker”有关?