1. ホーム
  2. リナックス

uwsgi用のホイールの構築失敗(install uwsgi)または cryptography用のホイールの構築失敗(install pymql)。

2022-03-17 10:28:04

uwsgi を virtualenv にインストールできませんでした、または pymql のインストールに失敗しました。



システムはubuntu 16.04です。 



pythonのバージョンは3.6です。



ソリューション

	private static void unzipDirWithPassword(final String sourceZipFile, String destinationDir, final String password) {
		RandomAccessFile randomAccessFile = null;
		IInArchive inArchive = null;
		try {
			randomAccessFile = new RandomAccessFile(sourceZipFile, "r");
			inArchive = SevenZip.openInArchive(null,
					new RandomAccessFileInStream(randomAccessFile));

			ISimpleInArchive simpleInArchive = inArchive.getSimpleInterface();

			// If the destination folder does not exist, create a new one
			File destinationFolder = new File(destinationDir);
			if (!destinationFolder.exists())
				new File(destinationDir).mkdirs();

			for (final ISimpleInArchiveItem item : simpleInArchive.getArchiveItems()) {

				final int[] hash = new int[] { 0 };
				if (!item.isFolder()) {
					ExtractOperationResult result;
					final long[] sizeArray = new long[1];
					//If the zip file comes with a folder, create the folder in here
					//Also, if the zip file has an empty folder, the empty folder cannot be extracted.
					if (item.getPath().indexOf(File.separator) > 0) {
						String path = destinationDir + File.separator
								+ item.getPath().substring(0, item.getPath().lastIndexOf(File.separator));
						File folderExisting = new File(path);
						if (!folderExisting.exists())
							new File(path).mkdirs();
					}
					// the decompressed file
					OutputStream out = new FileOutputStream(destinationDir + File.separator + item.getPath());
					// If the file is very large, this method can be used to decompress the whole file, but of course it's okay to use this for small files
					result = item.extractSlow(new ISequentialOutStream() {
						public int write(final byte[] data) throws SevenZipException {
							try {
								out.write(data);
							} catch (Exception e) {
								e.printStackTrace();
							}
							hash[0] |= Arrays.hashCode(data);
							sizeArray[0] += data.length;
							return data.length; 
						}
					}, password); 
					out.close();

					if (result == ExtractOperationResult.OK) {
						System.out.println(String.format("%9X | %10s | %s", //
								hash[0], sizeArray[0], item.getPath()));
					} else {
						System.out.println("Error extracting item: " + result);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (inArchive ! = null) { try {
				try {
					inArchive.close();
				} catch (SevenZipException e) {
					System.err.println("Error closing archive: " + e);
					e.printStackTrace();
				}
			}
			if (randomAccessFile ! = null) {
				try {
					randomAccessFile.close();
				} catch (IOException e) {
					System.err.println("Error closing file: " + e);
					e.printStackTrace();
				}
			}
		}