精华内容
下载资源
问答
  • build
    千次阅读
    2021-02-13 20:56:51

    简介

    build.gradle是gradle中非常重要的一个文件,因为它描述了gradle中可以运行的任务,今天本文将会带大家体验一下如何创建一个build.gradle文件和如何编写其中的内容。

    project和task

    gradle是一个构建工具,所谓构建工具就是通过既定的各种规则,将原代码或者原文件通过一定的task处理过后,打包生成目标文件的步骤。

    所以我们在gradle中有两个非常重要的概念,分别是项目和任务。

    每一个gradle的构建任务可以包含一个或者多个项目,项目可以有多种类型,比如是一个web项目或者一个java lib项目等。为了实现project要完成的目标,需要定义一个个的task来辅助完成目标。

    task主要用来执行特定的任务,比如编译class文件,打包成jar,生成javadoc等等。

    一个例子

    接下来我们使用一个具体的例子来讲解一下,gradle到底是怎么用的。

    首先我们创建一个新的project目录:

    $ mkdir gradle-test
    $ cd gradle-test
    

    gradle提供了一个init方法,来方便的创建gradle项目的骨架,我们用下看:

    gradle init
    Starting a Gradle Daemon (subsequent builds will be faster)
    
    Select type of project to generate:
      1: basic
      2: application
      3: library
      4: Gradle plugin
    Enter selection (default: basic) [1..4] 2
    
    Select implementation language:
      1: C++
      2: Groovy
      3: Java
      4: Kotlin
      5: Scala
      6: Swift
    Enter selection (default: Java) [1..6] 3
    
    Split functionality across multiple subprojects?:
      1: no - only one application project
      2: yes - application and library projects
    Enter selection (default: no - only one application project) [1..2] 1
    
    Select build script DSL:
      1: Groovy
      2: Kotlin
    Enter selection (default: Groovy) [1..2] 1
    
    Select test framework:
      1: JUnit 4
      2: TestNG
      3: Spock
      4: JUnit Jupiter
    Enter selection (default: JUnit 4) [1..4] 1
    
    Project name (default: gradle-test):
    Source package (default: gradle.test):
    
    > Task :init
    Get more help with your project: https://docs.gradle.org/6.7/samples/sample_building_java_applications.html
    
    BUILD SUCCESSFUL in 45s
    2 actionable tasks: 2 executed
    

    按照你的需要,经过一系列的选择之后,就可以生成一个基本的gradle项目了。

    我们看下生成的文件和目录:

    .
    ├── app
    │   ├── build.gradle
    │   └── src
    │       ├── main
    │       │   ├── java
    │       │   │   └── gradle
    │       │   │       └── test
    │       │   │           └── App.java
    │       │   └── resources
    │       └── test
    │           ├── java
    │           │   └── gradle
    │           │       └── test
    │           │           └── AppTest.java
    │           └── resources
    ├── gradle
    │   └── wrapper
    │       ├── gradle-wrapper.jar
    │       └── gradle-wrapper.properties
    ├── gradlew
    ├── gradlew.bat
    └── settings.gradle
    
    14 directories, 8 files
    

    其中gradle-wrapper是帮你自动设置和安装gradle的工具,同时它还提供了gradlew和gradlew.bat这两个执行文件,用来执行gradle的任务。

    我们主要看其中的两个配置文件,settings.gradle和build.gradle。

    settings.gradle中配置的是gradle中要build的项目信息:

    rootProject.name = 'gradle-test'
    include('app')
    

    上面的例子中,rootProject.name指定了项目的名字,include(‘app’)表示需要引入一个叫做app的子项目,这个子项目中包含着实际的要打包的内容。

    再看一下app中的build.gradle文件:

    plugins {
        // Apply the application plugin to add support for building a CLI application in Java.
        id 'application'
    }
    
    repositories {
        // Use JCenter for resolving dependencies.
        jcenter()
    }
    
    dependencies {
        // Use JUnit test framework.
        testImplementation 'junit:junit:4.13'
    
        // This dependency is used by the application.
        implementation 'com.google.guava:guava:29.0-jre'
    }
    
    application {
        // Define the main class for the application.
        mainClass = 'gradle.test.App'
    }
    

    很简单,指定了插件,仓库地址,依赖包和应用程序的main class路径。

    一切准备好之后,我们就可以进行构建和运行了。

    有两种方式来运行,一种方式就是使用系统自带的gradle命令,一种方式就是使用刚刚gradle为你生成的gradlew。

    gradle run
    
    > Configure project :app
    Repository ${repo.url} replaced by $REPOSITORY_URL .
    
    > Task :app:run
    Hello World!
    
    gradle build
    
    > Configure project :app
    Repository ${repo.url} replaced by $REPOSITORY_URL .
    
    BUILD SUCCESSFUL in 2s
    7 actionable tasks: 6 executed, 1 up-to-date
    

    你还可以带上 --scan 参数将build上传到gradle scan中,得到更加详细的构建分析:

    ./gradlew build --scan
    
    BUILD SUCCESSFUL in 0s
    7 actionable tasks: 7 executed
    
    Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service.
    Do you accept these terms? [yes, no] yes
    
    Gradle Terms of Service accepted.
    
    Publishing build scan...
    https://gradle.com/s/5u4w3gxeurtd2
    

    task详细讲解

    上面的例子中,我们使用的都是gradle默认的tasks,并没有看到自定义task的使用,接下来我们将会探讨一下,如何在build.gradle编写自己的task。

    这里我们使用的groovy来编写build.gradle,所以我们可以像运行代码一样来运行它。

    task脚本

    先创建一个非常简单的task:

    task hello {
        doLast {
            println 'Hello www.flydean.com!'
        }
    }
    

    上面定义了一个名叫hello的task,并且会在执行最后输出 “Hello www.flydean.com!”。

    我们这样运行:

    gradle -q hello
    Hello www.flydean.com!
    

    -q的意思是悄悄的执行,将会忽略gradle自身的log信息。我们把要执行的task名字写在gradle后面就可以了。

    如果你熟悉ant命令的话,可以看到gradle的task和ant很类似,不过更加的强大。

    因为是groovy脚本,所以我们可以在其中执行代码:

    task upper {
        doLast {
            String someString = 'www.flydean.com'
            println "Original: $someString"
            println "Upper case: ${someString.toUpperCase()}"
        }
    }
    

    运行结果:

    > gradle -q upper
    Original: www.flydean.com
    Upper case: WWW.FLYDEAN.COM
    

    或者执行times操作:

    task count {
        doLast {
            4.times { print "$it " }
        }
    }
    
    > gradle -q count
    0 1 2 3
    

    task依赖

    gradle中的一个task可以依赖其他的task:

    task hello {
        doLast {
            println 'Hello www.flydean.com!'
        }
    }
    task intro {
        dependsOn hello
        doLast {
            println "I'm flydean"
        }
    }
    

    上面两个task的顺序是无关的,可以依赖的写在前面,被依赖的写在后面,或者反过来都成立。

    动态task

    除了静态的task之外,我们还可以通过代码来动态创建task:

    4.times { counter ->
        task "task$counter" {
            doLast {
                println "I'm task number $counter"
            }
        }
    }
    
    > gradle -q task1
    I'm task number 1
    

    我们还可以将task看做成为一个对象,调用gradle的api进行操作:

    4.times { counter ->
        task "task$counter" {
            doLast {
                println "I'm task number $counter"
            }
        }
    }
    task0.dependsOn task2, task3
    

    上面的例子中,我们调用API手动创建了task之间的依赖关系:

    > gradle -q task0
    I'm task number 2
    I'm task number 3
    I'm task number 0
    

    还可以task之间的属性调用:

    task myTask {
        ext.myProperty = "www.flydean.com"
    }
    
    task printTaskProperties {
        doLast {
            println myTask.myProperty
        }
    }
    

    默认task

    如果不想每次都在调用gradle命令的时候手动指定某个具体的task名字,我们可以使用defaultTasks:

    defaultTasks 'clean', 'run'
    
    task clean {
        doLast {
            println 'Default Cleaning!'
        }
    }
    
    task run {
        doLast {
            println 'Default Running!'
        }
    }
    
    task other {
        doLast {
            println "I'm not a default task!"
        }
    }
    

    上面的代码执行gradle和gradle clean run是相当的。

    build script的外部依赖

    既然build script可以用groovy代码来编写,那么如果我们想要在build script中使用外部的jar包怎么办呢?

    这个时候,我们可以将外部依赖放到buildscript()方法中,后面的task就可以使用引入的依赖了:

    import org.apache.commons.codec.binary.Base64
    
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath group: 'commons-codec', name: 'commons-codec', version: '1.2'
        }
    }
    
    task encode {
        doLast {
            def byte[] encodedString = new Base64().encode('hello world\n'.getBytes())
            println new String(encodedString)
        }
    }
    

    上面的例子中,encode使用了一个外部的依赖包Base64,这个依赖包是在buildscript方法中引入的。

    本文已收录于 http://www.flydean.com/gradle-build-script/

    最通俗的解读,最深刻的干货,最简洁的教程,众多你不知道的小技巧等你来发现!

    欢迎关注我的公众号:「程序那些事」,懂技术,更懂你!

    更多相关内容
  • Visual C++ 2015 Build Tools

    热门讨论 2017-10-27 14:48:46
    visualcppbuildtools_full.exe (Visual C++ 2015 Build Tools Standalone compiler, libraries and scripts)
  • 在项目打包中遇到这个问题; 起初删除 node_modules 和 package-lock.json 都删除了 然后再 用npm cache clear --force 清理缓存 再 npm install 以为这样就可以了...结果还是不行 最后 重新安装webpack 结果就可以...

     

    在项目打包中遇到这个问题; 起初删除 node_modulespackage-lock.json 都删除了 然后再

    npm cache clear --force 清理缓存 再 npm install 以为这样就可以了...结果还是不行

    最后 重新安装webpack  结果就可以了  : npm add webpack@4.5.0 

    如果大家遇到相同的问题 可以试试这个方法   如果我的方法没能帮到大家....那可以再看看别人的

    文章..

    展开全文
  • 一,mac环境安装cryptography报错: 命令:pip3 install cryptography --user Collecting cryptography Using cached ... Installing build depe

    一,mac环境安装cryptography报错:
    命令:pip3 install cryptography --user

    Collecting cryptography
      Using cached https://files.pythonhosted.org/packages/fa/2d/2154d8cb773064570f48ec0b60258a4522490fcb115a6c7c9423482ca993/cryptography-3.4.6.tar.gz
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
        Preparing wheel metadata ... done
    Collecting cffi>=1.12 (from cryptography)
      Using cached https://files.pythonhosted.org/packages/a8/20/025f59f929bbcaa579704f443a438135918484fffaacfaddba776b374563/cffi-1.14.5.tar.gz
    Collecting pycparser (from cffi>=1.12->cryptography)
      Using cached https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl
    Building wheels for collected packages: cryptography
      Building wheel for cryptography (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
       command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /var/folders/l_/cn2h3f3152571h8yxm1_gxvr0000gn/T/tmpw3rnlmtv
           cwd: /private/var/folders/l_/cn2h3f3152571h8yxm1_gxvr0000gn/T/pip-install-iv4rg9xe/cryptography
      Complete output (161 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.14.6-arm64-3.8
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography
      copying src/cryptography/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography
      copying src/cryptography/utils.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography
      copying src/cryptography/__about__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography
      copying src/cryptography/exceptions.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography
      copying src/cryptography/fernet.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat
      copying src/cryptography/hazmat/_der.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat
      copying src/cryptography/hazmat/_types.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat
      copying src/cryptography/hazmat/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat
      copying src/cryptography/hazmat/_oid.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/oid.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/ocsp.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/general_name.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/extensions.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/name.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/base.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      copying src/cryptography/x509/certificate_transparency.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/x509
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends
      copying src/cryptography/hazmat/backends/interfaces.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends
      copying src/cryptography/hazmat/backends/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/_serialization.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/cmac.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/_asymmetric.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/_cipheralgorithm.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/poly1305.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/constant_time.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/keywrap.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/hmac.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/hashes.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      copying src/cryptography/hazmat/primitives/padding.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/bindings
      copying src/cryptography/hazmat/bindings/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/bindings
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/x448.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/backend.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/ec.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/ciphers.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/ocsp.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/x509.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/aead.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/encode_asn1.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/rsa.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/dh.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/cmac.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/utils.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/poly1305.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/ed25519.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/dsa.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/decode_asn1.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/hmac.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/ed448.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/x25519.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      copying src/cryptography/hazmat/backends/openssl/hashes.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/backends/openssl
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/scrypt.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/pbkdf2.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/hkdf.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/x963kdf.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/kbkdf.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      copying src/cryptography/hazmat/primitives/kdf/concatkdf.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/kdf
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/totp.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/hotp.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/twofactor
      copying src/cryptography/hazmat/primitives/twofactor/utils.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/twofactor
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/pkcs12.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/pkcs7.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/ssh.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/serialization
      copying src/cryptography/hazmat/primitives/serialization/base.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/serialization
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/algorithms.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/aead.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/modes.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/ciphers
      copying src/cryptography/hazmat/primitives/ciphers/base.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/ciphers
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/x448.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/ec.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/rsa.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/dh.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/utils.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/ed25519.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/dsa.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/ed448.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/x25519.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      copying src/cryptography/hazmat/primitives/asymmetric/padding.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/primitives/asymmetric
      creating build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/bindings/openssl
      copying src/cryptography/hazmat/bindings/openssl/__init__.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/bindings/openssl
      copying src/cryptography/hazmat/bindings/openssl/_conditional.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/bindings/openssl
      copying src/cryptography/hazmat/bindings/openssl/binding.py -> build/lib.macosx-10.14.6-arm64-3.8/cryptography/hazmat/bindings/openssl
      running egg_info
      writing src/cryptography.egg-info/PKG-INFO
      writing dependency_links to src/cryptography.egg-info/dependency_links.txt
      writing requirements to src/cryptography.egg-info/requires.txt
      writing top-level names to src/cryptography.egg-info/top_level.txt
      reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      no previously-included directories found matching 'docs/_build'
      warning: no previously-included files found matching 'vectors'
      warning: no previously-included files matching '*' found under directory 'vectors'
      warning: no previously-included files matching '*' found under directory '.github'
      warning: no previously-included files found matching 'release.py'
      warning: no previously-included files found matching '.coveragerc'
      warning: no previously-included files found matching 'codecov.yml'
      warning: no previously-included files found matching '.readthedocs.yml'
      warning: no previously-included files found matching 'dev-requirements.txt'
      warning: no previously-included files found matching 'tox.ini'
      warning: no previously-included files found matching 'mypy.ini'
      warning: no previously-included files matching '*' found under directory '.zuul.d'
      warning: no previously-included files matching '*' found under directory '.zuul.playbooks'
      writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
      copying src/cryptography/py.typed -> build/lib.macosx-10.14.6-arm64-3.8/cryptography
      running build_ext
      generating cffi module 'build/temp.macosx-10.14.6-arm64-3.8/_padding.c'
      creating build/temp.macosx-10.14.6-arm64-3.8
      generating cffi module 'build/temp.macosx-10.14.6-arm64-3.8/_openssl.c'
      running build_rust
      
          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cryptography:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Read https://cryptography.io/en/latest/installation.html for specific
             instructions for your platform.
          3) Check our frequently asked questions for more information:
             https://cryptography.io/en/latest/faq.html
          4) Ensure you have a recent Rust toolchain installed:
             https://cryptography.io/en/latest/installation.html#rust
          5) If you are experiencing issues with Rust for *this release only* you may
             set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
          =============================DEBUG ASSISTANCE=============================
      
      error: can't find Rust compiler
      
      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
      
      To update pip, run:
      
          pip install --upgrade pip
      
      and then retry package installation.
      
      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      
      This package requires Rust >=1.41.0.
      ----------------------------------------
      ERROR: Failed building wheel for cryptography
      Running setup.py clean for cryptography
      ERROR: Command errored out with exit status 1:
       command: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/l_/cn2h3f3152571h8yxm1_gxvr0000gn/T/pip-install-iv4rg9xe/cryptography/setup.py'"'"'; __file__='"'"'/private/var/folders/l_/cn2h3f3152571h8yxm1_gxvr0000gn/T/pip-install-iv4rg9xe/cryptography/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
           cwd: /private/var/folders/l_/cn2h3f3152571h8yxm1_gxvr0000gn/T/pip-install-iv4rg9xe/cryptography
      Complete output (36 lines):
      running clean
      removing 'build/temp.macosx-10.14.6-arm64-3.8' (and everything under it)
      removing 'build/lib.macosx-10.14.6-arm64-3.8' (and everything under it)
      'build/bdist.macosx-10.14.6-arm64' does not exist -- can't clean it
      'build/scripts-3.8' does not exist -- can't clean it
      removing 'build'
      running clean_rust
      
          =============================DEBUG ASSISTANCE=============================
          If you are seeing a compilation error please try the following steps to
          successfully install cryptography:
          1) Upgrade to the latest pip and try again. This will fix errors for most
             users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
          2) Read https://cryptography.io/en/latest/installation.html for specific
             instructions for your platform.
          3) Check our frequently asked questions for more information:
             https://cryptography.io/en/latest/faq.html
          4) Ensure you have a recent Rust toolchain installed:
             https://cryptography.io/en/latest/installation.html#rust
          5) If you are experiencing issues with Rust for *this release only* you may
             set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
          =============================DEBUG ASSISTANCE=============================
      
      error: can't find Rust compiler
      
      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.
      
      To update pip, run:
      
          pip install --upgrade pip
      
      and then retry package installation.
      
      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      
      This package requires Rust >=1.41.0.
      ----------------------------------------
      ERROR: Failed cleaning build dir for cryptography
    Failed to build cryptography
    Building wheels for collected packages: cffi
      Building wheel for cffi (setup.py) ... done
      Created wheel for cffi: filename=cffi-1.14.5-cp38-cp38-macosx_10_14_6_arm64.whl size=258017 sha256=45d30880bdd77fcf8bcd5349435c29f951bd566beb6c851ca1558b217e21c61b
      Stored in directory: /Users/cuixin/Library/Caches/pip/wheels/cf/14/00/656047b7f0b1add314a90c6832a5d9ae86479c8974ff2c3262
    Successfully built cffi
    ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
    WARNING: You are using pip version 19.2.3, however version 21.0.1 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    
    

    二,解决方案:

    pip3 install --upgrade pip --user
    

    无法为使用PEP 517且无法直接安装的scipy构建轮子(ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly)

    展开全文
  • Python3.6在Win10环境下,装不上pyav,出现报错: ...ERROR: Could not build wheels for av which use PEP 517 and cannot be installed directly: (C:\Users\Jayce\Anaconda3\envs\tf1.7) E:\Code\Python.........

    Windows安装pyav报错:ERROR: Failed building wheel for av.Failed to build av. ERROR: Could not build wheel

    1.软件环境

    2.问题描述

    3.解决方法(Python3.5-3.9都可以解决)

    3.1.获取编译好的安装文件

    3.2.安装获取到的WHL文件


    1.软件环境

    Windows10 教育版64位
    Python 3.6.3

    2.问题描述

    Python3.6Windows环境下,使用pip命令安装pyav:

    pip install av

    出现如下报错,导致装不上pyav:

            ERROR: Failed building wheel for av
            Failed to build av
            ERROR: Could not build wheels for av which use PEP 517 and cannot be installed directly:

    (C:\Users\Jayce\Anaconda3\envs\tf1.7) E:\Code\Python>pip install av
    Looking in indexes: https://pypi.doubanio.com/simple
    Collecting av
      Downloading https://pypi.doubanio.com/packages/00/3f/9fe21065912902a7856a69df334a67b73a51da5e08ff033fd79f15d05764/av-9.1.1.tar.gz (2.4 MB)
         |████████████████████████████████| 2.4 MB 3.2 MB/s
      Installing build dependencies ... done
      Getting requirements to build wheel ... done
        Preparing wheel metadata ... done
    Building wheels for collected packages: av
      Building wheel for av (PEP 517) ... error
      ERROR: Command errored out with exit status 1:
       command: 'C:\Users\Jayce\Anaconda3\envs\tf1.7\python.exe' 'C:\Users\Jayce\Anaconda3\envs\tf1.7\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\J
    ayce\AppData\Local\Temp\tmpctqsnqx6'
           cwd: C:\Users\Jayce\AppData\Local\Temp\pip-install-hi4s2fdw\av_03c9287622cf4da7918135c5be424e7b
      Complete output (38 lines):
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.6
      creating build\lib.win-amd64-3.6\av
      copying av\about.py -> build\lib.win-amd64-3.6\av
      copying av\datasets.py -> build\lib.win-amd64-3.6\av
      copying av\deprecation.py -> build\lib.win-amd64-3.6\av
      copying av\__init__.py -> build\lib.win-amd64-3.6\av
      copying av\__main__.py -> build\lib.win-amd64-3.6\av
      creating build\lib.win-amd64-3.6\av\audio
      copying av\audio\__init__.py -> build\lib.win-amd64-3.6\av\audio
      creating build\lib.win-amd64-3.6\av\codec
      copying av\codec\__init__.py -> build\lib.win-amd64-3.6\av\codec
      creating build\lib.win-amd64-3.6\av\container
      copying av\container\__init__.py -> build\lib.win-amd64-3.6\av\container
      creating build\lib.win-amd64-3.6\av\data
      copying av\data\__init__.py -> build\lib.win-amd64-3.6\av\data
      creating build\lib.win-amd64-3.6\av\filter
      copying av\filter\__init__.py -> build\lib.win-amd64-3.6\av\filter
      creating build\lib.win-amd64-3.6\av\sidedata
      copying av\sidedata\__init__.py -> build\lib.win-amd64-3.6\av\sidedata
      creating build\lib.win-amd64-3.6\av\subtitles
      copying av\subtitles\__init__.py -> build\lib.win-amd64-3.6\av\subtitles
      creating build\lib.win-amd64-3.6\av\video
      copying av\video\__init__.py -> build\lib.win-amd64-3.6\av\video
      running build_ext
      building 'av.buffer' extension
      creating build\temp.win-amd64-3.6
      creating build\temp.win-amd64-3.6\Release
      creating build\temp.win-amd64-3.6\Release\src
      creating build\temp.win-amd64-3.6\Release\src\av
      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c logo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\Jayce\Anaconda3\envs\tf1.7\include -IC:\Users\Jayce\Anaconda
    3\envs\tf1.7\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Wi
    ndows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /Tcsrc\av\buffer.c /Fobuild\temp.win-amd6
    4-3.6\Release\src\av\buffer.obj
      buffer.c
      C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe logo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\Jayce\Anaconda3
    \envs\tf1.7\libs /LIBPATH:C:\Users\Jayce\Anaconda3\envs\tf1.7\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" "/LIBPATH:C:\Program Files (x86)\
    Windows Kits\10\lib\10.0.10240.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" avformat.lib avcodec.lib avdevice.lib avutil.lib avfilter.lib swscale.li
    b swresample.lib /EXPORT:PyInit_buffer build\temp.win-amd64-3.6\Release\src\av\buffer.obj /OUT:build\lib.win-amd64-3.6\av\buffer.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Rele
    ase\src\av\buffer.cp36-win_amd64.lib
      LINK : fatal error LNK1181: cannot open input file 'avformat.lib'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\link.exe' failed with exit status 1181
      ----------------------------------------
      ERROR: Failed building wheel for av
    Failed to build av
    ERROR: Could not build wheels for av which use PEP 517 and cannot be installed directly

    但是为啥其他人就能成功安装呢?

       

    3.解决方法(Python3.5-3.9都可以解决)

            发生上面的错误,是因为当前版本的pyav没有适合当前开发环境的版本(如我这边是Python 3.6),因此需要自己编译,而自己编译需要安装FFmpeg,进而导致因为没有FFmpeg引发了编译错误。因此有3种解决方法:

            1.换Python版本(之前写的代码,可能要做Python版本适配工作,不推荐);

            2.自己装FFmpeg,然后自己编译(较为繁琐);

            3.直接下载我这边提供编译好的安装文件(含Python3.5-3.9,适用于Windows、Linux、MacOS平台),直接选择对应的版本,然后使用pip本地安装即可(推荐)。

            由于方法1和2的局限性,建议使用方法3,直接安装:

    3.1.获取编译好的安装文件

      1.百度网盘下载我提供的工具:Win10安装pyav出现报错推荐,比CDSN便宜):

            链接:https://pan.baidu.com/s/1S6l5NktF_Go_lDphONg3CQ?pwd=0aou 提取码:0aou,下载后打开“微信支付.png”使用微信扫码支付:

                     获取压缩包密码的2种方式:

                    第1种方式:付款后微信留言购买的资源名称(上方橙色文字),博主会微信回复你解压密码(推荐,不需要加好友):

                             →  → 

                     第2种方式:截图支付凭证以及资源名称(上方橙色文字)在CSDN私信博主,博主会CSDN私聊你解压密码:

                        → 

             或直接在CSDN下载(不推荐!CSDN会随着下载次数增多而涨价,导致资源太贵) 

    3.2.安装获取到的WHL文件

    下载完毕后,根据自己电脑的系统、位数、python的版本,选择好适合自己的软件版本(如我这边是Win10 64位操作系统、python3.6,要安装pyav,那么就选择av-cp36-cp36m-win_amd64.whl这个文件),然后使用pip本地安装即可,pip本地安装可以参考这篇博客:

    pip安装本地指定版本的whl文件https://blog.csdn.net/qq_15969343/article/details/79055603

     可以看到pyav已经成功安装,且能正常导入使用了:

    展开全文
  • running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.6 creating build\lib.win-amd64-3.6\fasttext copying python\fasttext_module\fasttext\FastText.py -> ...
  • RoboMaster视觉笔记CMake(五)build-type

    千次阅读 2020-05-29 10:32:45
    examples/01-basic/F-build-type/build' /usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 0$ mkdir build $ cd build/ /build$ cmake .....
  • build-tools-21.1.1 build-tools_r21.1.1-windows

    千次下载 热门讨论 2015-02-07 15:16:53
    这个是安装android studio 失败后提示The following SDK component was not installed: build-tools-21.1.1 下载这个解压放到目录下就好了
  • unity 监听build前、build完成后事件

    千次阅读 2022-02-23 14:28:39
    using System.Collections; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEditor.Build;...public class BuildReport:IPostprocessBuildWithReport,IPreprocessBuildWithRe
  • npm run build卡在node build/build.js

    千次阅读 2021-03-25 12:36:59
    npm run build执行打包一直卡在node build/build.js处不动 解决:在build/check-versions.js里注释如下代码 if (shell.which('npm')) { versionRequirements.push({ name: 'npm', currentVersion: exec('npm --...
  • 具体有效报错信息: SSH: put [provider.jar] SSH: Disconnecting configuration [官网(xx.xx.xx...Build step 'Send build artifacts over SSH' changed build result to UNSTABLE Finished: UNSTABLE 原因排查: ..
  • Build step 'Execute shell' marked build as failure
  • Flutter build-runner工具简单使用

    千次阅读 2020-09-21 12:31:43
    build_runner 提供了一些用于生成文件的通用命令,这些命令中有的可以用于测试生成的文件,有的可以用于对外提供这些生成的文件以及它们的源代码。 如果你开发的是 Web :你可以使用webdev 工具替代 build_runner ...
  • 1、什么是 dockerfile 2、docker镜像制作的工作逻辑 3、Dockerfile的基本结构 4、Dockerfile格式 案例: 5、Build镜像
  • docker-compose的build使用

    千次阅读 2021-12-21 19:39:54
    在docker-compose.yml 文件中使用 build选项编译镜像。 1 简单使用 2 context 3. dockerfile
  • The expression ${build.finalName} is deprecated. Please use ${project.build.finalName} instead.故障修复方法
  • docker build与Dockerfile用法解释

    千次阅读 多人点赞 2020-09-22 18:03:58
    第一次用docker build创建maven项目的镜像时,心中存在以下疑惑:docker build时,把哪些文件放到了镜像里?然后网上查阅资料时,发现好多误导人的博客,尤其是以下错误居多: 这个点.不是表示Dockerfile所在...
  • Build Module target 目录的内容:
  • Build.gradle 详细配置说明

    千次阅读 2020-12-31 09:53:22
    module 的 build.gradle 文件注解apply plugin: 'com.android.application' //说明 module 的类型,com.android.application 为程序android {compileSdkVersion 22 //编译的SDK版本buildToolsVersion "22.0.1" //...
  • 科普 eclipse中的Java build

    千次阅读 2021-02-26 13:15:27
    在刚学eclipse的时候,build path是经常会用到的,但经常就是跟着教程走,额就不太懂这是干嘛的,然后今天看见极客视频里有相关的讲解,来记录一下。Build Path 是指定Java工程所包含的资源属性集合,在一个成熟的...
  • Android Studio在Build过程中,出现如下图的乱码: 之所以会这样,是因为我的电脑硬盘不小心被分区格式化过,项目弄丢了,后面使用硬盘恢复工具找回来的,编码出现了错误。 解决方法: 1、Android Studio工具...
  • ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
  • 有时候flutter执行了pop方法返回到上一个界面,上一个界面突然就执行了build方法,其实我们并不希望上个界面执行build,可以在上个界面添加如下方法即可解决自动build的问题。 @override void ...
  • NDK 开发之 ndk-build 的使用

    千次阅读 2020-09-29 21:53:26
    dk-build 本质上是一个脚本,它的位置就在 NDK 目录的最上层,即在< NDK >/ndk-build 路径下。运行 ndk-build 脚本相当于运行以下命令: $GNUMAKE -f <ndk>/build/core/build-local.mk <parameters&...
  • build文件夹是项目构建webpack相关代码 文件目录如下: build build.js 生产环境构建代码 check-version.js 检查node npm 版本 utils.js 构建工具相关 vue-loader.conf.js webpack ...
  • IDEA build委托到Maven build

    千次阅读 2020-11-12 09:54:23
    —— IDEA中的maven项目下,可能出现这种情况:代码编辑器中无编译错误,通过maven 的clean 、compile、package进行各种操作也都没问题,但是单击绿色箭头运行(默认会先执行IDE本身的Build操作)却报:程序包xxx不...
  • catkin_make, cmake, catkin build区别

    万次阅读 多人点赞 2019-10-30 19:29:55
    文章目录1 catkin的历史1.1 Legacy Catkin Workflow1.2 Isolated Catkin Workflow1.3 Parallel Isolated Catkin Workflow and catkin build2 cmake和catkin_make区别3 catkin_make和catkin build3.1 catkin_make 和 ...
  • bazel build tensorflow 选项

    万次阅读 2021-07-16 11:46:22
    bazel build //tensorflow/tools/pip_package:build_pip_package --config=v2 --config=noaws --config=nogcp --config=nohdfs --config=cuda --compilation_mode=dbg --strip=never -c opt --copt="-m64" --cxxopt=...
  • Android studio中的BuildConfig类

    千次阅读 2022-04-12 15:02:08
    Android studio; BuildConfig类
  • Maven之pom.xml文件中的Build配置

    万次阅读 多人点赞 2019-03-08 17:29:50
    Maven之pom.xml文件中的Build配置 前言 在日常的开发中,我们经常使用maven来管理和构建我们的项目,即使现在使用了各种springboot等方便快捷的框架,jar包的引入也是通过maven来进行的,因此有必要了解pom.xml文件中的...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,106,433
精华内容 1,242,573
关键字:

build