通过柯南安装QT时发生依赖性冲突

时间:2019-10-02 09:43:04

标签: qt cmake dependencies ubuntu-18.04 conan

我在通过柯南安装和使用qt时遇到问题。 实际错误如下所示:

import numpy as np
import netCDF4 
import netCDF4 as nc
import pandas as pd
import numpy as np
import csv
#### === User-inputs ====#####
one = nc.Dataset('1979.nc') ##load one of your nc datafiles

print one.variables ## Check variables names, say my variable names are lat, lon, pre

## Name of the variables
lat_name = 'latitude'
lon_name = 'longitude'
time_name = 'time'
data_name1 = 'UGRD_10maboveground'
data_name2 = 'VGRD_10maboveground'

## Select spatial range for which data to be extracted
mylat1 = 35
mylat2 = 39
mylon1 = -2
mylon2 = 8

##Give a name of your extracted datafile and define units
newfilename = 'Extracted_Data' 
time_unit = 'day since 1979-01-01 00:00'
lat_unit = 'degrees_south'
lon_unit = 'degrees_east'
data_unit = 'm/s'
#### ======= Rest of the Code is Automated ========######

##Find pixel-range based on the provided lat-lon
lat = one.variables[lat_name][:]
lon = one.variables[lon_name][:]

   ver_pix = []
   for i in xrange(0, len(lat)):
        if lat[i] >= mylat1 and lat[i] <= mylat2:
   ver_pix.append(i)

y_min = min(ver_pix)
y_max = max(ver_pix)
print lat[min(ver_pix):max(ver_pix)]


hor_pix = []
for j in xrange(0,len(lon)):
    if lon[j] >= mylon1 and lon[j] <= mylon2:
    hor_pix.append(j)

x_min = min(hor_pix)
x_max = max(hor_pix)
print lon[min(hor_pix):max(hor_pix)]

check_range1 = one.variables[data_name1][:,y_min:y_max,x_min:x_max]  ##pre:lat:lon = 
time,y,x
check_range2 = one.variables[data_name2][:,y_min:y_max,x_min:x_max]
#print check_range
print check_range1.shape
print check_range2.shape


## Load all nc files in the directory from which data to be extracted
## ..for the selected area
f = nc.MFDataset('1979.nc') 
alldata = f.variables[data_name1][:,y_min:y_max,x_min:x_max]
alldata = f.variables[data_name2][:,y_min:y_max,x_min:x_max]
lat1 = one.variables[lat_name][y_min:y_max]
lon1 = one.variables[lon_name][x_min:x_max]
#time = one.variables[time_name][:]

ncfile = nc.Dataset(''+str(newfilename)+'.nc','w')

ncfile.createDimension(time_name,len(alldata))

ncfile.createDimension(lat_name,len(lat1))
ncfile.createDimension(lon_name,len(lon1))

time = ncfile.createVariable(time_name,np.dtype('float32').char,(time_name,))
lats = ncfile.createVariable(lat_name,np.dtype('float32').char,(lat_name,))
lons = ncfile.createVariable(lon_name,np.dtype('float32').char,(lon_name,))

time.units = time_unit
lats.units = lat_unit
lons.units = lon_unit
time[:] = np.linspace(1,len(alldata),len(alldata))
lats[:] = lat1
lons[:] = lon1

newdata1 = ncfile.createVariable(data_name1,np.dtype('float32').char, 
(time_name,lat_name,lon_name))
newdata2 = ncfile.createVariable(data_name2,np.dtype('float32').char, 
(time_name,lat_name,lon_name))
newdata1.units = data_unit 
newdata2.units = data_unit 
newdata1[:] = alldata[:]
newdata2[:] = alldata[:]
dtime=netCDF4.num2date(time[:],time.units)
UGRD_ts=pd.Series(data_name2,index=dtime)
UGRD_ts.to_csv('data1.csv', index=True, header=True)

我的WARN: glib/2.58.3@bincrafters/stable: requirement zlib/1.2.11 overridden by qt/5.13.0@bincrafters/stable to zlib/1.2.11@conan/stable WARN: pcre/8.41: requirement zlib/1.2.11 overridden by glib/2.58.3@bincrafters/stable to zlib/1.2.11@conan/stable ERROR: Conflict in pcre/8.41 Requirement bzip2/1.0.8 conflicts with already defined bzip2/1.0.8@conan/stable To change it, override it in your base requirements

conanfile.txt

我设法通过在[requires] gtest/1.8.1@bincrafters/stable boost/1.70.0@conan/stable jsonformoderncpp/3.7.0@vthiery/stable qt/5.13.0@bincrafters/stable [generators] cmake [options] qt:with_mysql=False 部分添加bzip2/1.0.8@conan/stable来解决这种依赖性,但是我的应用程序缺少必需的字体:

[requires]

QFontDatabase: Cannot find font directory /home/<user>/.conan/data/qt/5.13.0/bincrafters/stable/package/82f32da7b204a38af07f00f05f94ebbfd7454b77/lib/fonts. Note that Qt no longer ships fonts. Deploy some (from https://dejavu-fonts.github.io/ for example) or switch to fontconfig. 目录实际上丢失了。请注意,该项目在其他同事,同一台机器上构建和运行时都没有此类问题。

问题是-造成这些问题的原因以及如何解决这些问题?

1 个答案:

答案 0 :(得分:0)

应该通过切换到qt/5.13.1@bincrafters/stable解决依赖冲突,因为许多依赖已迁移到柯南中心。 关于字体问题,我正在对qt配方中的fontconfig/2.13.1@conan/stable添加可选的依赖项。在此期间,您可以尝试安装系统版本的fontconfig,重建qt配方,然后检查输出是否具有“ Fontconfig ..................... ........是的”