当我测试google-vision-api时,每次都显示如下:
Fatal error: Uncaught exception
'Google\Cloud\Core\Exception\ServiceException' with message 'cURL
error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)' in
/Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RequestWrapper.php:245
Stack trace: #0
/Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RequestWrapper.php(150):
Google\Cloud\Core\RequestWrapper->convertToGoogleException(Object(Google\Cloud\Core\Exception\ServiceException))
#1 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RestTrait.php(96):
Google\Cloud\Core\RequestWrapper->send(Object(GuzzleHttp\Psr7\Request),
Array) #2
/Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-vision/Connection/Rest.php(59):
Google\Cloud\Vision\Connection\Rest->send('images', 'annotate', Array)
#3 /Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-vision/VisionClient.php(269):
Google\Cloud\Vision\Connection\Rest->annotate(Array) #4
/Library/Server/Web/Data/Sites/local in
/Library/Server/Web/Data/Sites/localhost/gvision/vendor/google/cloud-core/RequestWrapper.php
on line 245
我按照此page上的步骤操作,我的代码只是google中的示例。
我现在在中国,但我一直在使用VPN。如果有人能弄明白的话,它会有很大的帮助。
答案 0 :(得分:0)
我已经弄明白了.OS服务器无法访问VPN。 这就是它的介绍所说:它是一个单独销售的操作系统附加组件,它提供额外的服务器程序以及macOS的管理和管理工具。 所以我改为使用MAMP来替换它以在我的Mac上设置Apache服务器。它对我有用。