我试图在Linux Mint 17.2 Rafaela上使用pip3安装awscli.
我收到错误:
Traceback (most recent call last):
File "/home/jonathan/.local/bin/aws", line 19, in <module>
import awscli.clidriver
ImportError: No module named 'awscli'
Run Code Online (Sandbox Code Playgroud)
这些是我正在采取的步骤,遵循aws安装指南:
sudo pip install awscli --upgrade --user
Run Code Online (Sandbox Code Playgroud)
一切似乎安装得很好.
添加到我的.bashrc
export PATH=~/.local/bin:$PATH
Run Code Online (Sandbox Code Playgroud)
然后
source ~/.bashrc
Run Code Online (Sandbox Code Playgroud)
然后我尝试命令
aws --version
Run Code Online (Sandbox Code Playgroud)
我明白了
Traceback (most recent call last):
File "/home/jonathan/.local/bin/aws", line 19, in <module>
import awscli.clidriver
ImportError: No module named 'awscli'
Run Code Online (Sandbox Code Playgroud)
有人能帮忙吗?
编辑:对于访问此问题的任何人.我无法测试任何这些答案,因为我已经删除了这个操作系统并安装了Ubuntu.此外,我不再需要awscli了.
我是OpenLayers的新手,我正在寻找一些帮助在地图上绘制线条,我一直在尝试从各种不同的帖子中绘制LineStrings的各种东西,但我无法让它工作!我只需要弄清楚如何在坐标之间画一条线.
继承了我试过但没有用的一些代码:
var points = [
new ol.geom.Point([78.65, -32.65]),
new ol.geom.Point([-98.65, 12.65])
];
var featureLine = new ol.Feature({
geometry: new ol.geom.LineString(points)
});
var sourceLine = new ol.source.Vector({
features: [featureLine]
});
var vectorLine = new ol.layer.Vector({
source: sourceLine
});
map.addLayer(vectorLine);
Run Code Online (Sandbox Code Playgroud)
我也试过这个但无济于事:
var layerLine = new ol.layer.Vector({
source: new ol.source.Vector({
features: [new ol.Feature({
geometry: new ol.geom.LineString(points, 'XY'),
name: 'Line'
})]
}),
});
map.addLayer(vectorLine);
Run Code Online (Sandbox Code Playgroud)
有人能指出我正确的方向吗?或者告诉我哪里出错了?
编辑:感谢Jonatas,工作代码如下所示:
var coordinates = [[78.65, -32.65], [-98.65, 12.65]];
var layerLines = new ol.layer.Vector({
source: new ol.source.Vector({
features: [new …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 HTML 地理定位来获取我的位置。有趣的是,它一直工作得非常出色,直到它停止工作的某个看似随机的点。现在我得到的是带有消息的错误回调:
Unknown error acquiring position
Run Code Online (Sandbox Code Playgroud)
这发生在我第一次开始开发应用程序的那天。它是一个在 Node/Express 中构建的 Web 应用程序。我使用的浏览器是 Firefox v53 64 位。
位置是允许的,我还尝试了一个我在网上找到的修复方法,它涉及到 about:config 并geo.wifi.uri从以下位置更改:
https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_API_KEY%
Run Code Online (Sandbox Code Playgroud)
到
https://www.googleapis.com/geolocation/v1/geolocate?key=test
Run Code Online (Sandbox Code Playgroud)
这对我不起作用。
然而,这确实适用于我的手机 Firefox 应用程序,但不适用于 Google Chrome 应用程序。
这是一个示例代码片段:
const geo = navigator.geolocation;
geo.getCurrentPosition(success, failure);
function success(position) {
lat = position.coords.latitude;
lng = position.coords.longitude;
$('#coords').val(lat + ',' + lng);
mapView.setCenter(ol.proj.fromLonLat([lng, lat]));
}
function failure(error) {
console.log(error.message);
}
Run Code Online (Sandbox Code Playgroud)
完整页面:https : //github.com/ThriceGood/Spots/blob/master/views/index.html
任何人都可以对这个问题有所了解吗?
我正在尝试设置矢量图层的单独特征的填充颜色.使用下面的代码,我想我将能够遍历这些功能并单独设置它们的填充样式,但是会出现一个奇怪的问题.如果没有setStyle函数,则会在控制台中记录功能的各种属性.id,名称和几何.大约有5个左右的功能被记录下来.基本上就像
room1
room2
room3
room4
room5
Run Code Online (Sandbox Code Playgroud)
每个下面的额外数据(id,几何)
但是当我添加用于设置功能填充的行时,我遇到了一个奇怪的问题.它似乎将循环挂在第一个功能上,并且控制台填满了该功能属性的日志,例如:
room1
room1
room1
room1
room1
room1
room1
Run Code Online (Sandbox Code Playgroud)
很长一段时间,到达firefox日志限制的点,它告诉我没有显示2000条目!
但从好的方面来说,第一个功能实际上确实改变了它的填充颜色!所以我认为我使用的代码行至少是一半!但肯定存在一些严重错误.
代码:
vector.getSource().on('change', function (evt) {
var source = evt.target;
if (source.getState() === 'ready') {
var features = vector.getSource().getFeatures()
for (var k in features) {
console.log(features[k].getProperties()['name']);
console.log(features[k].getProperties()['id']);
console.log(features[k].getGeometry()['n']);
features[k].setStyle(new ol.style.Style({fill: fill}));
}
}
});
Run Code Online (Sandbox Code Playgroud)
我真的不太了解OL3或造型功能,我通过大量的试验和猜测来达到这个目的.任何人都能指出我正确的方向吗?
我一直在尝试获取django-registration-redux帐户激活电子邮件以发送给新注册的用户。
我已经使用了所有与电子邮件无关的部分,例如登录/注销和实际注册用户!当我注册时,它会自动以该用户身份登录。但是我从来没有收到激活邮件。
我尝试了各种不同的方法来尝试使它起作用,我遵循了一些有关设置整个过程的教程,但是电子邮件仍然无法正常工作。
这是一些代码设置,我使用的是我在线下载的注册模板。
settings.py
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'registration',
'synths',
)
# user reg settings
REGISTRATION_OPEN = True
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_AUTO_LOGIN = True
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/login/'
# i tried including this line but still nothing
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
# email
# first i tried setting up the debbuging server with this CMD line
# python -m smtpd -n -c DebuggingServer localhost:1025
# i dont know if it worked!, i …Run Code Online (Sandbox Code Playgroud) python django smtp django-authentication django-registration
所以我想在我的镜像中包含一个 rsa 密钥,这样我就可以在构建镜像时将 git 存储库克隆到我的镜像中。但我真的不想将这个密钥保留在 docker build repo 中。有人对如何处理这个问题有好的建议吗?从 docker 文档和各种其他线程看来,似乎无法COPY从构建上下文之外获取文件。除了我不感兴趣使用以下解决方案之外:
对此有更好的解决方案吗?或者我是否必须将密钥保留在构建存储库中或从我想要使用的 rsa 密钥的位置进行构建?
我想一种可能的方法是 gitignore 构建存储库中的密钥,并在每次克隆它时将其放入,并在自述文件中记下它,以便其他开发人员也知道这样做。
---我的解决方案---
我认为这个问题没有“正确”的答案,但这是我采用的解决方案。
我(在某处)创建一个 linux 用户并为其生成一个密钥。然后在gitlab上创建一个只有repo克隆权限的用户。我将 linux 用户的公钥添加到 gitlab 用户。然后,对于构建,我创建 .ssh 文件夹并使用配置文件复制用户私钥。我只是将该用户密钥存储在 docker build 存储库中。
构建步骤:
RUN mkdir ~/.ssh
RUN touch ~/.ssh/known_hosts
RUN ssh-keyscan -t rsa gitlab_host > ~/.ssh/known_hosts
COPY ./ssh/config /root/.ssh
COPY ./ssh/id_rsa_app /root/.ssh
RUN chmod 600 /root/.ssh/id_rsa_app
Run Code Online (Sandbox Code Playgroud)
ssh 配置文件:
Host gitlab-app
HostName gitlab_host
IdentityFile /root/.ssh/id_rsa_app
IdentitiesOnly yes
Run Code Online (Sandbox Code Playgroud)
现在 git 克隆可以在构建内部工作。
我有一些代码可以从网页获取图像并将其显示在ImageView中.但由于某种原因,我不太理解,图像加载速度非常慢!通过我的日志记录,我可以看到图像的所有数据(base64字符串)很快到达,但图像在ImageView中显示大约需要12-15秒.
我发现这很奇怪,因为我使用NSStream以不同的方法获取图像的数据,并在所有数据到达时立即加载图像.但是使用这种URLSession方法,加载图像需要更长的时间.这没有多大意义!此方法不应影响ImageView加载该数据的方式.
有没有人想到为什么会这样?
继承人代码:
- (void)postMethod:(NSDictionary *)numDict
{
NSURL *url = [NSURL URLWithString:@"http://theWebAddress.com/aPage.php"]; // add url to page
NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
request.HTTPMethod = @"POST";
NSError *error = nil;
NSData *data = [NSJSONSerialization dataWithJSONObject:numDict options:kNilOptions error:&error];
NSLog(@"%@", numDict);
if (!error)
{
NSURLSessionUploadTask *uploadTask = [session uploadTaskWithRequest:request fromData:data completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
NSDictionary *diction = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
for (id key in diction)
{
if …Run Code Online (Sandbox Code Playgroud) javascript ×3
openlayers-3 ×2
aws-cli ×1
django ×1
docker ×1
dockerfile ×1
firefox ×1
geolocation ×1
html ×1
ios ×1
kml ×1
nsurlsession ×1
objective-c ×1
pip ×1
python ×1
python-3.x ×1
rsa ×1
smtp ×1
uiimageview ×1
vector ×1
xcode ×1