我想使用 Visual Studio Code 的调试器来调试我的 python 代码,但发生了异常。我使用 Windows 10、WSL、Debian、Python 3.7.6。
Exception has occurred: ModuleNotFoundError
No module named 'flask'
File "/home/kazu/test/main.py", line 2, in <module>
from flask import Flask
Run Code Online (Sandbox Code Playgroud)
这是 python 调试器控制台的记录。
pyenv shell 3.7.6
/home/kazu/.pyenv/versions/3.7.6/bin/python /home/kazu/.vscode-server/extensions/ms-python.python-2020.1.58038/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 52440 /home/kazu/test/main.py
kazu@D:~/test$ pyenv shell 3.7.6
kazu@D~/test$ /home/kazu/.pyenv/versions/3.7.6/bin/python /home/kazu/.vscode-server/extensions/ms-python.python-2020.1.58038/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 52440 /home/kazu/test/main.py
Run Code Online (Sandbox Code Playgroud)
但是,我已经使用 pipenv 安装了烧瓶。当我不使用调试器时,没有模块错误。
这是我的 main.py
from __future__ import unicode_literals
from flask import Flask
from flask import render_template
from flask import request
from flask …Run Code Online (Sandbox Code Playgroud) python visual-studio-code windows-subsystem-for-linux pipenv vscode-debugger
我想在 Google Cloud Compute Engine 上使用 Python3.8.x。
首先,我用gcloud命令创建了一个实例。
gcloud compute instances create \
pegasus-test \
--zone=asia-northeast1-b \
--machine-type=n1-highmem-8 \
--boot-disk-size=500GB \
--image-project=ml-images \
--image-family=tf-1-15 \
--maintenance-policy TERMINATE --restart-on-failure
Run Code Online (Sandbox Code Playgroud)
默认情况下,Python 版本为 3.5.3。
python3 -V
Python 3.5.3
Run Code Online (Sandbox Code Playgroud)
因此,我升级了 Python。我遵循了这个指令。(谷歌云计算引擎更改为 python 3.6)
cd /tmp
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
tar -xvf Python-3.8.3.tgz
cd Python-3.8.3
./configure
sudo apt-get install zlib1g-dev
sudo make
sudo make install
Run Code Online (Sandbox Code Playgroud)
我没有收到错误消息。现在,我有 Python3.8.3。
python3 -V
Python 3.8.3
Run Code Online (Sandbox Code Playgroud)
接下来,我想使用飞马。( https://github.com/google-research/pegasus )
git clone https://github.com/google-research/pegasus
cd pegasus
export PYTHONPATH=.
pip3 install …Run Code Online (Sandbox Code Playgroud) 我想意识到这一点。
我在 addpipe 的简单 recorder.js 示例的帮助下意识到了这一点。 https://github.com/addpipe/simple-recorderjs-demo
本示例使用php服务器,所以我改了原来的app.js。
原始 app.js
xhr.open("POST","uplod.php",true);
Run Code Online (Sandbox Code Playgroud)
我的 app.js
xhr.open("POST","/",true);
Run Code Online (Sandbox Code Playgroud)
我在本地检查了我的网络应用程序,然后一切看起来都很完美。我使用 Windows 10、WSL、Debian 10/buster、python3.7.6、Google Chrome。这是终端的记录。
127.0.0.1 - - [03/Feb/2020 11:53:17] "GET / HTTP/1.1" 200 -
./file.wav exists
127.0.0.1 - - [03/Feb/2020 11:53:32] "POST / HTTP/1.1" 200 -
Run Code Online (Sandbox Code Playgroud)
但是,当我使用 ffprobe 命令检查上传的“file.wav”时,它被破坏了。
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / …Run Code Online (Sandbox Code Playgroud) 我想在我的 Linux 计算机上安装 nvm。(我的Debian版本是10,Git版本是2.27。OPENSSL版本是1.1.1d 2019年9月10日)
我阅读了此文档https://github.com/nvm-sh/nvm#install--update-script 并输入了此脚本。
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Run Code Online (Sandbox Code Playgroud)
这就是结果。
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (60) SSL certificate problem: self signed certificate in certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn …Run Code Online (Sandbox Code Playgroud) 我想在 Linux (Debian 10) 的 Windows 子系统上开发 Flutter Web 应用程序。我遵循了这个指示。https://flutter.dev/docs/get-started/codelab-web
\n\nflutter channel beta\nflutter upgrade\nflutter config --enable-web\nRun Code Online (Sandbox Code Playgroud)\n\n首先,我在终端中输入这些命令,所有命令都运行良好。
\n\n其次,我尝试了flutter doctor命令,这就是结果。
Downloading android-arm-release/linux-x64 tools... 2.1s\nDownloading android-arm64-profile/linux-x64 tools... 1.8s\nDownloading android-arm64-release/linux-x64 tools... 1.6s\nDownloading android-x64-profile/linux-x64 tools... 1.6s\nDownloading android-x64-release/linux-x64 tools... 1.5s\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel beta, 1.18.0-11.1.pre, on Linux, locale en_US.UTF-8)\n[\xe2\x9c\x97] Android toolchain - develop for Android devices\n \xe2\x9c\x97 Unable to locate Android SDK.\n Install Android Studio from: https://developer.android.com/studio/index.html\n On first launch …Run Code Online (Sandbox Code Playgroud) 我对这个 Google Cloud Platform 的解决方案感兴趣,但我遇到了一个问题。 https://cloud.google.com/solutions/processing-user- generated-content-using-video-intelligence
我尝试在此 Github 存储库上提出问题,但没有问题选项卡。所以,我在这里发布我的问题。 https://github.com/GoogleCloudPlatform/cloud-functions-intelligentcontent-nodejs
我在 GCP 的 Cloud Shell 上完成了所有操作。
我按照教程https://cloud.google.com/solutions/processing-user- generated-content-using-video-intelligence 进行操作,一切都很完美,直到我部署了 GCStoPubsub 函数。
部署GCStoPubsub函数
首先,我尝试了这个。
gcloud functions deploy GCStoPubsub --stage-bucket gs://staging-kazu --trigger-topic upload_notification --entry-point GCStoPubsub
Run Code Online (Sandbox Code Playgroud)
然后,我收到此错误消息。
ERROR: (gcloud.functions.deploy) Missing required argument [runtime]: Flag `--runtime` is requir
ed for new functions.
Run Code Online (Sandbox Code Playgroud)
所以,我添加--runtime nodejs10并再次尝试。
gcloud functions deploy GCStoPubsub --stage-bucket gs://staging-kazu --trigger-topic upload_notification --entry-point GCStoPubsub --runtime nodejs10
Run Code Online (Sandbox Code Playgroud)
然后,我收到了更大的错误消息。
Deploying function (may take a while - up to 2 minutes)...failed. …Run Code Online (Sandbox Code Playgroud) 我想forEach在 JavaScript 中使用。
sentence.forEach(function(value) {--------
Whensentence是一个数组,forEach 正常工作。
{
"sentence": [
{
"word": [
{
"content": "tell"
},
{
"content": "me"
}
]
},
{
"word": [
{
"content": "do"
},
{
"content": "you"
},
{
"content": "want"
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是,当sentence只有一个值并且不是数组时,forEach 不起作用并且它会生成这样的错误消息。Uncaught TypeError: sentence.forEach is not a function
{
"sentence": {
"word": {
"content": "hello"
}
}
}
Run Code Online (Sandbox Code Playgroud)
我从外部 API 获取 json 对象,所以我不知道是sentence只有一个值还是多个值。我怎么解决这个问题?你能给我任何信息或建议吗?
我使用 Firebase Hosting 并希望实现这个网络应用程序。(我使用 Windows 10、Windows Subsystems for Linux、Debian 10.3 和 Google Chrome 浏览器。)
.onSnapshot. 将该数据放入 textarea (main.js)我通过了步骤 1~4,但在步骤 5 中遇到了困难。当我访问网络应用程序时,它会在我录制音频之前显示转录数据。
当我完成第 1 步到第 5 步时,我得到了另一个我想要的 textarea。
你能告诉我如何避免第一个 textarea 吗?先感谢您。
这是浏览器的控制台。
这是 main.js(客户端)
const startRecording = document.getElementById('start-recording');
const stopRecording = document.getElementById('stop-recording');
let recordAudio;
startRecording.disabled = false;
// on start button handler
startRecording.onclick = function() {
// recording started …Run Code Online (Sandbox Code Playgroud) javascript node.js firebase google-cloud-functions google-cloud-firestore