已安装aiohttp
,
pip3 install aiohttp
如上所述here
使用python3.6,
我看到以下错误:
import aiohttp
ModuleNotFoundError: No module named 'aiohttp'
如何解决此错误?
答案 0 :(得分:5)
这是因为你的function count(myGeometry) {
myGeometry=$.parseJSON(myGeometry);
var count=0;
$.each(myGeometry.features,function () {
if(this.properties.Fac_type=="Garbage" && this.properties.Situation=="Open"){
count++
}
});
alert(count);
console.log(count);
}
var myGeometry = JSON.stringify({
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"id": "178",
"name": "178_marker",
"Fac_type": "Garbage",
"Comment": "",
"Photo": "IMG_20170712_122714.jpg",
"Situation": "Open",
"Duration": "5 Days",
"Composition": "Organic",
"Collection_Date": "2017-07-12",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.84118652343751,
22.550610920226646
]
}
},
{
"type": "Feature",
"properties": {
"id": "131",
"name": "131_marker",
"Fac_type": "Carcass",
"Photo": "",
"Location": "Onroad",
"Situation": "Open",
"Duration": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.88787841796876,
22.872379306788158
]
}
},
{
"type": "Feature",
"properties": {
"id": "157",
"name": "157_marker",
"Fac_type": "Sewer",
"Photo": "",
"Situation": "Open",
"Matters": "Water",
"Duration": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.60498046875,
22.667244265664948
]
}
},
{
"type": "Feature",
"properties": {
"id": "187",
"name": "187_marker",
"Fac_type": "Manhole",
"Photo": "",
"Situation": "Open",
"Matters": "Water",
"Duration": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.97851562500001,
22.563293244707797
]
}
},
{
"type": "Feature",
"properties": {
"id": "212",
"name": "212_marker",
"Fac_type": "Septic_Tank",
"Photo": "",
"Situation": "Open",
"Matters": "Wastes",
"Duration": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.3468017578125,
22.715390019335942
]
}
},
{
"type": "Feature",
"properties": {
"id": "239",
"name": "239_marker",
"Fac_type": "Drains",
"Photo": "",
"Situation": "Other",
"Matters": "Other",
"Duration": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.68463134765625,
22.930571229938142
]
}
},
{
"type": "Feature",
"properties": {
"id": "264",
"name": "264_marker",
"Fac_type": "Ponds",
"Photo": "",
"Duration": "",
"Nature": "Semi_dry",
"Near_Si": "",
"Collection_Date": "2017-07-13",
"Remarks": "",
"Situation": "Dirty"
},
"geometry": {
"type": "Point",
"coordinates": [
87.43194580078125,
22.821757357861237
]
}
},
{
"type": "Feature",
"properties": {
"id": "120",
"name": "120_marker",
"Fac_type": "Ceremonial_house",
"Photo": "",
"Duration": "Night_time",
"Nature": "Loud_speaker",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.14880371093751,
22.705255477207526
]
}
},
{
"type": "Feature",
"properties": {
"id": "150",
"name": "150_marker",
"Data_name": "Dog House",
"Fac_type": "Animal_sheds",
"Photo": "",
"Situation": "Uncleaned",
"Duration": "5 Days",
"Nature": "Dog",
"Nearness": "Y",
"Collection_Date": "2017-07-13",
"Remarks": "444"
},
"geometry": {
"type": "Point",
"coordinates": [
88.10485839843751,
22.902743425252357
]
}
},
{
"type": "Feature",
"properties": {
"id": "260",
"name": "260_marker",
"Fac_type": "Hooking",
"Photo": "",
"Duration": "",
"Nature": "Domestic",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.50860595703126,
22.690052257634015
]
}
},
{
"type": "Feature",
"properties": {
"id": "285",
"name": "285_marker",
"Fac_type": "Mobile_tower",
"Photo": "",
"Location": "On_the_ground",
"Duration": "",
"Service_provider": "",
"Count": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.31909179687501,
22.844539566770546
]
}
},
{
"type": "Feature",
"properties": {
"id": "310",
"name": "310_marker",
"Fac_type": "Mela",
"Photo": "",
"Duration": "",
"Nearness": "",
"Purpose": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.31085205078126,
23.006436171834565
]
}
},
{
"type": "Feature",
"properties": {
"id": "335",
"name": "335_marker",
"Fac_type": "Urinal",
"Photo": "",
"Situation": "Potted",
"Duration": "",
"Nature": "Domestic",
"Collection_Date": "2017-07-13",
"Remarks": "",
"Nearness": "rrrrr"
},
"geometry": {
"type": "Point",
"coordinates": [
87.98950195312501,
23.01402032323799
]
}
},
{
"type": "Feature",
"properties": {
"id": "363",
"name": "363_marker",
"Fac_type": "Spitting",
"Photo": "",
"Location": "On_the_road_side",
"Situation": "Open",
"Duration": "",
"Nature": "Domestic",
"Collection_Date": "2017-07-13",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.14056396484376,
23.049407390110577
]
}
},
{
"type": "Feature",
"properties": {
"id": "396",
"name": "396_marker",
"Fac_type": "Sound_Morning",
"Photo": "",
"Duration": "",
"Human": "Yes",
"Vehicle": "Bi_cycle",
"Collection_Date": "2017-07-13",
"Remarks": "",
"Magnitude_in_DB": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.50311279296876,
22.842008398595794
]
}
},
{
"type": "Feature",
"properties": {
"id": "425",
"name": "425_marker",
"Fac_type": "Sound_Noon",
"Photo": "",
"Duration": "",
"Human": "Yes",
"Vehicle": "",
"Collection_Date": "",
"Remarks": "",
"Magnitude_in_DB": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.79449462890625,
22.996323306867165
]
}
},
{
"type": "Feature",
"properties": {
"id": "450",
"name": "450_marker",
"Fac_type": "Sound_Afternoon",
"Photo": "",
"Duration": "",
"Human": "Yes",
"Vehicle": "",
"Collection_Date": "",
"Remarks": "",
"Magnitude_in_DB": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.98675537109375,
22.72805714175105
]
}
},
{
"type": "Feature",
"properties": {
"id": "475",
"name": "475_marker",
"Data_name": "Abonormal",
"Fac_type": "Odour",
"Photo": "",
"Duration": "",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.77252197265625,
22.72299043351299
]
}
},
{
"type": "Feature",
"properties": {
"id": "500",
"name": "500_marker",
"Fac_type": "Smoke",
"Photo": "",
"Duration": "",
"Origin": "Industrial",
"Colour": "Black",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.58026123046875,
22.80909892750663
]
}
},
{
"type": "Feature",
"properties": {
"id": "525",
"name": "525_marker",
"Fac_type": "Waterlogging",
"Photo": "",
"Location": "On_the_road",
"Duration": "",
"Nature": "Leakege",
"Collection_Date": "",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.52258300781251,
22.98873816096074
]
}
},
{
"type": "Feature",
"properties": {
"id": "178",
"name": "178_marker",
"Fac_type": "Garbage",
"Comment": "",
"Photo": "IMG_20170712_115610.jpg",
"Situation": "Dispersed",
"Duration": "5 Days",
"Composition": "Organic",
"Collection_Date": "2017-07-12",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.65716552734376,
22.497332432882345
]
}
},
{
"type": "Feature",
"properties": {
"id": "292",
"name": "292_marker",
"Fac_type": "Canal",
"Photo": "",
"Situation": "Stagnant",
"Duration": "2 Days",
"Nature": "Hydrophytic",
"Collection_Date": "2017-07-13",
"Remarks": "",
"Near_Si": "y"
},
"geometry": {
"type": "Point",
"coordinates": [
88.25042724609376,
22.525242774383898
]
}
},
{
"type": "Feature",
"properties": {
"id": "288",
"name": "288_marker",
"Fac_type": "Stream",
"Photo": "",
"Situation": "Slugged",
"Duration": "2 Days",
"Nature": "Clean",
"Nearness": "y",
"Collection_Date": "2017-07-13",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.00073242187501,
22.461802035333992
]
}
},
{
"type": "Feature",
"properties": {
"id": "228",
"name": "228_marker",
"Fac_type": "Bushes",
"Photo": "",
"Location": "On_land",
"Situation": "Cleaned",
"Duration": "2 days",
"Nature": "y",
"Collection_Date": "2017-07-13",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.39624023437501,
22.53285370752713
]
}
},
{
"type": "Feature",
"properties": {
"id": "197",
"name": "197_marker",
"Fac_type": "Trees",
"Photo": "",
"Location": "Other",
"Situation": "Canopy",
"Duration": "1 Day",
"Nature": "n",
"Collection_Date": "2017-07-13",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.1103515625,
22.545537663981865
]
}
},
{
"type": "Feature",
"properties": {
"id": "210",
"name": "210_marker",
"Fac_type": "Excavation",
"Photo": "",
"Situation": "On_the_road",
"Duration": "1 Day",
"Nature": "Construction",
"Collection_Date": "2017-07-13",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
87.87139892578126,
22.471954507739227
]
}
},
{
"type": "Feature",
"properties": {
"id": "243",
"name": "243_marker",
"Fac_type": "Blockage",
"Photo": "",
"Location": "On_the_ground",
"Duration": "2 Days",
"Nature": "Repair",
"Collection_Date": "2017-07-13",
"Remarks": ""
},
"geometry": {
"type": "Point",
"coordinates": [
88.0059814453125,
22.461802035333992
]
}
}
]
});
count(myGeometry);
不在python3.6 PYTHONPATH中。我一直认为使用<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
安装Python软件包的最佳方法是使用pip3
选项将其作为脚本运行。
pip