在 GitlabCi 期间,我得到:“致命错误:调用 ListObjectsV2 操作时发生错误(AccessDenied):拒绝访问”
我的存储桶策略:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:*",
"Resource": "arn:aws:s3:::BUCKET-NAME/*"
}
]
Run Code Online (Sandbox Code Playgroud)
}
在 gitlabCI 设置中:
我的 .gitlab-ci.yml
image: docker:latest
stages:
- build
- deploy
build:
stage: build
image: node:8.11.3
script:
- export API_URL="d144iew37xsh40.cloudfront.net"
- npm install
- npm run build
- echo "BUILD SUCCESSFULLY"
artifacts:
paths:
- public/
expire_in: 20 mins
environment:
name: production
only:
- master
deploy: …Run Code Online (Sandbox Code Playgroud) 在我的数据框中的一列中,我有五个值:
1,G,2,3,4
Run Code Online (Sandbox Code Playgroud)
如何使它将所有“G”的名称更改为 1
我试过:
df = df['col_name'].replace({'G': 1})
Run Code Online (Sandbox Code Playgroud)
我也试过:
df = df['col_name'].replace('G',1)
Run Code Online (Sandbox Code Playgroud)
“G”其实就是1(不知道为什么会有混合命名)
编辑:
正常工作:
df['col_name'] = df['col_name'].replace({'G': 1})
Run Code Online (Sandbox Code Playgroud) 我已经安装了 3.73 版的 python,但对于 jupyter 笔记本,我安装了3.6.8. 如何在 jupyter notebook 上将 python 升级到 3.7+ 版本?
我试过:
conda update jupyter
conda upgrade notebook
Run Code Online (Sandbox Code Playgroud)
当我在 virtual env python -VI 中输入终端时得到 3.73 但是当我在 jupyter 中检查它时:
from platform import python_version
print(python_version())
Run Code Online (Sandbox Code Playgroud)
我明白了3.6.8。
我在虚拟机上安装 docker 时遇到问题。\n我已按照以下步骤操作:
\n1. 旧版本的 Docker 称为 docker、docker.io 或 docker-engine。如果安装了这些,请卸载\n它们:
\nsudo apt-get remove docker docker-engine docker.io containerd runc
2.更新apt包索引
\nsudo apt-get update
3. 安装软件包以允许 apt 通过 HTTPS 使用存储库:
\n sudo apt-get install \\\n apt-transport-https \\\n ca-certificates \\\n curl \\\n gnupg \\\n lsb-release\nRun Code Online (Sandbox Code Playgroud)\n4.添加Docker\xe2\x80\x99s官方GPG密钥:
\ncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
5. 使用以下命令设置稳定存储库:
\n echo \\\n "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg]\n https://download.docker.com/linux/ubuntu \\\n $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >\n /dev/null\nRun Code Online (Sandbox Code Playgroud)\n … 我非常想将最后一个单元格的输出保存在一个 txt 文件中。
q = [rng.next () for _ in range (0, 25000000)]
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用 pandas 数据框,但我需要 txt 文件来执行 Diehard 测试。在 jupyter notebook 中可行吗?执行Dieharder Suite可能需要什么类型的数据?
我几乎可以肯定,一旦我做了类似的事情,不幸的是我不记得是怎么做的,我找不到明确的答案
下面是我的 LCG 随机数生成器的代码:
import numpy as np
class LCG(object):
UZERO: np.uint32 = np.uint32(0)
UONE : np.uint32 = np.uint32(1)
def __init__(self, seed: np.uint32, a: np.uint32, c: np.uint32) -> None:
self._seed: np.uint32 = np.uint32(seed)
self._a : np.uint32 = np.uint32(a)
self._c : np.uint32 = np.uint32(c)
def next(self) -> np.uint32:
self._seed = self._a * self._seed + self._c …Run Code Online (Sandbox Code Playgroud) 建模时出现此错误。我无法弄清楚这个错误来自哪里。
整个算法旨在描述产品(衣服)。这部分识别衣服的颜色。
数据框正确加载。
下面我放了很多代码,因为我不知道我到底哪里出错了。
# path to the training set
TRAIN_LABELS_FILE = "train/labels.txt"
# path to the validation set
VAL_LABELS_FILE = "val/labels.txt"
# path to the test set
TEST_LABELS_FILE = "test/labels.txt"
# Color names
COLOR_FILE = "names.txt"
# Specify image size
IMG_WIDTH = 224
IMG_HEIGHT = 224
CHANNELS = 3
color = pd.read_csv(COLOR_FILE)
color = color.T
color_list = list(color.iloc[0])
color_list.insert(0,'beige')
color_list.insert(0,'path')
train = pd.read_csv(TRAIN_LABELS_FILE,sep=" ",names=color_list)
def crop_image_from_gray(img, tol=7):
"""
Applies masks to the orignal image and
returns the a preprocessed …Run Code Online (Sandbox Code Playgroud) 我将单元格的输出保存为 txt 文件,如下所示:
第一个单元格:
%%capture cap --no-stderr
print(q)
Run Code Online (Sandbox Code Playgroud)
第二个单元格:
with open('output.txt', 'w') as f:
f.write(cap.stdout)
Run Code Online (Sandbox Code Playgroud)
下面是我想保存的一小段代码:
#%%
np.seterr(over='ignore')
a = np.uint32(1664525)
c = np.uint32(1013904223)
seed = np.uint32(1)
rng = LCG(seed, a, c)
q = [rng.next() for _ in range(0, 2500000)]
Run Code Online (Sandbox Code Playgroud)
文件已保存,但是生成的数字由逗号分隔,但我希望每个生成的数字由新行而不是逗号分隔
我尝试将“w”更改为“a”并添加“\ n”,如下所示,但它对我不起作用。
with open('output.txt', 'a') as f:
f.write("\n")
Run Code Online (Sandbox Code Playgroud) 当我尝试安装fastai( pip install fastai) 时,出现以下错误:
AttributeError: module 'enum' has no attribute 'IntFlag'
Run Code Online (Sandbox Code Playgroud)
完整追溯:
Installing build dependencies ... error
ERROR: Complete output from command /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-b8vreosn/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'numpy==1.13.3; python_version=='"'"'2.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.5'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.14.5; python_version>='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'2.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.5'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'':
ERROR: Traceback (most recent call …Run Code Online (Sandbox Code Playgroud)