我按照官方文件给出的说明进行操作,但卡在执行中./install.sh。
MacOS 版本:10.14.5 (18F132) Python 版本:python2.7
下载 gcloud 网站提供的 zip 文件后,我运行命令。./install.sh它告诉我
weiziyangdeMacBook-Pro:google-cloud-sdk weiziyang$ ./install.sh
Welcome to the Google Cloud SDK!
ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
globals()[__func_name] = __get_hash(__func_name)
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line …Run Code Online (Sandbox Code Playgroud) 当我使用硒来控制Chrome时,我遇到了麻烦.这是我的代码:
from selenium import webdriver
driver = webdriver.Chrome()
Run Code Online (Sandbox Code Playgroud)
当我尝试操作它时,它首先成功运行,Chrome在屏幕上弹出.然而,它在几秒钟后关闭.

Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\chrome.exe')
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
self.assert_process_still_running()
File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages\selenium\webdriver\common\service.py", line 99, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\chrome.exe unexpectedly exited. Status code was: 0
Run Code Online (Sandbox Code Playgroud) selenium google-chrome web-crawler python-3.x selenium-webdriver
我在自己的电脑上部署了我的服务,一切都运行良好,我决定把它放在我的服务器上。但我发现有些请求受到“CORS”的限制,而有些则不受限制。
Web 服务器是部署在 Linux 上的 Nginx。后端框架为Django,DRF提供api服务,前端框架为Vue.js,Ajax请求库使用axios。代码在我自己的 Mac 上运行非常完美,没有 CORS 问题。但它在服务器上出现了问题。顺便说一句,Vue.js 中路由的模式是history模式。
这是我的 Nginx 配置代码:
server {
listen 80;
server_name 167.179.111.96;
charset utf-8;
location / {
root /root/blog-frontend/dist;
try_files $uri $uri/ @router;
index index.html;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods *;
}
location @router {
rewrite ^.*$ /index.html last;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 Vue.js 代码,它有“CORS”问题。
主文件
Vue.prototype.API = api
Vue.prototype.GLOBAL = global
Vue.prototype.$axios = Axios;
Axios.defaults.headers.get['Content-Type'] = 'application/x-www-form-urlencoded'
Axios.defaults.headers.post['Content-Type'] = 'multipart/form-data'
Run Code Online (Sandbox Code Playgroud)
重定向.vue
<template>
<div id="notfound">
<div class="notfound">
<div class="notfound-404">
<h1>Redirect</h1>
</div> …Run Code Online (Sandbox Code Playgroud) cors ×1
django ×1
gcloud ×1
gsutil ×1
macos ×1
nginx ×1
python-2.7 ×1
python-3.x ×1
selenium ×1
vue.js ×1
web-crawler ×1