Building QT projects from the command line

/************************************************************************
 *            Building QT projects from the command line
 * 说明:
 *     很多时候都是通过Qtcreator进行项目的创建以及编译,但是有时候可能
 * 会遇到一些编译小问题,这时候命令行创建工程、编译工程可以作为测试、验证
 * 的一种手段。
 *
 *                                     2016-3-2 深圳 南山平山村 曾剑锋
 ***********************************************************************/

一、参考文档:
    Building QT projects from the command line
        http://processors.wiki.ti.com/index.php/Building_QT_Projects

二、基本操作流程:
    1. After Installing your host Ubuntu and then the SDK on your host machine: [How to install Ubuntu and your SDK]
        在你电脑上安装Ubuntu及SDK。
    2. Create a new directory on your Ubuntu 10.04 host.
        在Ubuntu中创建一个目录,叫:hello-world。
        user@user-desktop:~$mkdir hello-world
    3. Change to that directory
        进入刚刚创建的目录 。
        user@user-desktop:~$cd hello-world
    4. Source the environment setup to get access to qmake and the gcc compiler
        导入环境变量,这样你才能够使用qmake和gcc编译器。
        user@user-desktop:~/hello-world$ source /home/user/ti-sdk-am335x-evm-05.03.00.00/linux-devkit/environment-setup
    5. Create a new file: hello-world.cpp and copy in the following source code to hello-world.cpp
        创建hello-world.cpp文件,并将以下源代码拷入文件中。
        #include <QApplication>
        #include <QLabel>
    
        int main(int argc, char **argv)
        {
            QApplication app(argc, argv);
            
            QLabel label("Hello World!");
            label.show();
            
            return app.exec();
        }
    6. Execute the following commands: (If you already have a project file skip step 1)
        执行以下命令:(如果你已经有一个工程项目文件,请跳过这一步)
        [linux-devkit]:~/hello-world> qmake -project // The first command creates a project file: hello-world.pro.
        [linux-devkit]:~/hello-world> qmake // The second generates a makefile based on the project file.
        [linux-devkit]:~/hello-world> make // The third compiles and builds the project.
    
    7. This is what you have just created
        这是刚刚你创建的文件,或者生成的文件。
        [linux-devkit]:~/hello-world> ls
        hello-world  hello-world.cpp  hello-world.o  hello-world.pro  Makefile
    8. copy the hello-world binary over to your file system and run hello-world on your target.
        将hello-world二进制文件拷入你的文件系统,并在目标机器上运行。

 

转载于:https://www.cnblogs.com/zengjfgit/p/5234075.html

权所有(C) Microsoft Corporation。保留所有权利。 安装最新的 PowerShell,了解新功能和改进!https://aka.ms/PSWindows (.venv1) PS D:\OCR\AW> pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting altgraph==0.17.2 (from -r requirements.txt (line 1)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/84/3f/1a5c9bef54cac9bf41edd6f4aaf61cd52ed578e10ccc607e0278012cb4a5/altgraph-0.17.2-py2.py3-none-any.whl (21 kB) Collecting cycler==0.11.0 (from -r requirements.txt (line 2)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5c/f9/695d6bedebd747e5eb0fe8fad57b72fdf25411273a39791cde838d5a8f51/cycler-0.11.0-py3-none-any.whl (6.4 kB) Collecting dlib==19.23.0 (from -r requirements.txt (line 3)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/25/0f/05e70b2ebf6a539c4c397c7c3dd19b69e0b3d650443e12a8af4866f65b03/dlib-19.23.0.tar.gz (3.2 MB) Preparing metadata (setup.py) ... done Collecting fonttools==4.33.3 (from -r requirements.txt (line 4)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2f/85/2f6e42fb4b537b9998835410578fb1973175b81691e9a82ab6668cf64b0b/fonttools-4.33.3-py3-none-any.whl (930 kB) Collecting future==0.18.2 (from -r requirements.txt (line 5)) Using cached future-0.18.2-py3-none-any.whl Collecting importlib-metadata==4.11.4 (from -r requirements.txt (line 6)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ab/b5/1bd220dd470b0b912fc31499e0d9c652007a60caf137995867ccc4b98cb6/importlib_metadata-4.11.4-py3-none-any.whl (18 kB) Collecting kiwisolver==1.4.2 (from -r requirements.txt (line 7)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/49/75/3a5f894ff63a2f13bd68d7962d01b9393bba139335cf9f47b2eb8739e63b/kiwisolver-1.4.2-cp39-cp39-win_amd64.whl (55 kB) Collecting matplotlib==3.5.2 (from -r requirements.txt (line 8)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/43/64/1d949d0fab5b83071290a46c93de28cbd8ff15a75b533d6c134012c61e4d/matplotlib-3.5.2-cp39-cp39-win_amd64.whl (7.2 MB) Collecting numpy==1.21.6 (from -r requirements.txt (line 9)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/4d/04/bcd62448f2e772bc90a73ba21bacaa19817ae9905ae639969462862bd071/numpy-1.21.6-cp39-cp39-win_amd64.whl (14.0 MB) Collecting opencv-python==4.5.2.54 (from -r requirements.txt (line 10)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/7c/5d/5581984f71c3378f913057beb4a0c53a22d71dd1b6d49457314ecd26c5af/opencv_python-4.5.2.54-cp39-cp39-win_amd64.whl (34.7 MB) Collecting packaging==21.3 (from -r requirements.txt (line 11)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl (40 kB) Collecting pefile==2022.5.30 (from -r requirements.txt (line 12)) Using cached pefile-2022.5.30-py3-none-any.whl Collecting Pillow==9.1.1 (from -r requirements.txt (line 13)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/cc/d9/5d0c2a0146fe68781a1920fa2a68d81bc55de38bed50beb8bf2493e0c7c1/Pillow-9.1.1-cp39-cp39-win_amd64.whl (3.3 MB) Collecting pyinstaller==5.1 (from -r requirements.txt (line 14)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/39/0c/fcedab1fc19e4a7b275c5298bb9c69e411d5092ceaf5a167b611de4c023d/pyinstaller-5.1-py3-none-win_amd64.whl (1.2 MB) Collecting pyinstaller-hooks-contrib==2022.7 (from -r requirements.txt (line 15)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/de/97/9901350320f0454a04a937666235f532353c55507679cca9712464760431/pyinstaller_hooks_contrib-2022.7-py2.py3-none-any.whl (234 kB) Collecting pyparsing==3.0.9 (from -r requirements.txt (line 16)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/6c/10/a7d0fa5baea8fe7b50f448ab742f26f52b80bfca85ac2be9d35cdd9a3246/pyparsing-3.0.9-py3-none-any.whl (98 kB) Collecting PyQt5==5.15.6 (from -r requirements.txt (line 17)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/be/f2/8e7b751d102ce3500cbeff97cb514eaf5c06d5e423676c37e9de28d0c06b/PyQt5-5.15.6-cp36-abi3-win_amd64.whl (6.7 MB) Collecting PyQt5-Qt5==5.15.2 (from -r requirements.txt (line 18)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/37/97/5d3b222b924fa2ed4c2488925155cd0b03fd5d09ee1cfcf7c553c11c9f66/PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB) Collecting PyQt5-sip==12.10.1 (from -r requirements.txt (line 19)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/f7/83/eecd013e3d38648e54a63ffe85639a481a14e09f4e75423968e915196937/PyQt5_sip-12.10.1-cp39-cp39-win_amd64.whl (77 kB) Collecting python-dateutil==2.8.2 (from -r requirements.txt (line 20)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) Collecting pywin32-ctypes==0.2.0 (from -r requirements.txt (line 21)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/9e/4b/3ab2720f1fa4b4bc924ef1932b842edf10007e4547ea8157b0b9fc78599a/pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB) Collecting six==1.16.0 (from -r requirements.txt (line 22)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting typing_extensions==4.2.0 (from -r requirements.txt (line 23)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl (24 kB) Collecting zipp==3.8.0 (from -r requirements.txt (line 24)) Using cached https://pypi.tuna.tsinghua.edu.cn/packages/80/0e/16a7ee38617aab6a624e95948d314097cc2669edae9b02ded53309941cfc/zipp-3.8.0-py3-none-any.whl (5.4 kB) Requirement already satisfied: setuptools in d:\ocr\aw\.venv1\lib\site-packages (from pyinstaller==5.1->-r requirements.txt (line 14)) (68.2.0) Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [60 lines of output] running bdist_wheel running build running build_py running build_ext C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if LooseVersion(cmake_version) < '3.1.0': Building extension for Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\d lib_63c12b5a1a2f485aaf617ed09e75027e\build\lib.win-amd64-cpython-39 -DPYTHON_EXECUTABLE=D:\OCR\AW\.venv1\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\build\lib.win-amd64-cpython-39 -A x64' -- Building for: Visual Studio 17 2022 CMake Error at CMakeLists.txt:2 (CMAKE_MINIMUM_REQUIRED): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py", line 222, in <module> setup( File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\__init__.py", line 103, in setup return distutils.core.setup(**attrs) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup return run_commands(dist) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands dist.run_commands() File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\OCR\AW\.venv1\lib\site-packages\wheel\bdist_wheel.py", line 364, in run self.run_command("build") File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv1\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py", line 134, in run self.build_extension(ext) File "C:\Users\Admin\AppData\Local\Temp\pip-install-o09thgtz\dlib_63c12b5a1a2f485aaf617ed09e75027e\setup.py", line 171, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-o09thgtz\\dlib_63c12b5a1a2f485aaf617ed09e75027e\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\AppD ata\\Local\\Temp\\pip-install-o09thgtz\\dlib_63c12b5a1a2f485aaf617ed09e75027e\\build\\lib.win-amd64-cpython-39', '-DPYTHON_EXECUTABLE=D:\\OCR\\AW\\.venv1\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-o09thgtz\\dlib_63c12b5a1a2f485aaf617ed09e75027e\\build\\lib.win-amd64-cpython-39', '-A', 'x64']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Running setup.py clean for dlib Failed to build dlib ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects [notice] A new release of pip is available: 23.2.1 -> 25.1.1 [notice] To update, run: python.exe -m pip install --upgrade pip (.venv1) PS D:\OCR\AW> 怎么办
06-13
(.venv) PS D:\OCR\AW> pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: altgraph==0.17.2 in d:\ocr\aw\.venv\lib\site-packages (from -r requirements.txt (line 1)) (0.17.2) Requirement already satisfied: cycler==0.11.0 in d:\ocr\aw\.venv\lib\site-packages (from -r requirements.txt (line 2)) (0.11.0) Collecting dlib==19.23.0 (from -r requirements.txt (line 3)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/25/0f/05e70b2ebf6a539c4c397c7c3dd19b69e0b3d650443e12a8af4866f65b03/dlib-19.23.0.tar.gz (3.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2/3.2 MB 5.9 MB/s eta 0:00:00 Preparing metadata (setup.py) ... done Requirement already satisfied: fonttools==4.33.3 in d:\ocr\aw\.venv\lib\site-packages (from -r requirements.txt (line 4)) (4.33.3) Requirement already satisfied: future==0.18.2 in d:\ocr\aw\.venv\lib\site-packages (from -r requirements.txt (line 5)) (0.18.2) Requirement already satisfied: importlib-metadata==4.11.4 in d:\ocr\aw\.venv\lib\site-packages (from -r requirements.txt (line 6)) (4.11.4) Collecting kiwisolver==1.4.2 (from -r requirements.txt (line 7)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/97/2d/32ae1ce44d5b514dce568a809b3bed15d60ee1501b9fa9853a0fee705b59/kiwisolver-1.4.2-cp38-cp38-win_amd64.whl (55 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.4/55.4 kB 2.8 MB/s eta 0:00:00 Collecting matplotlib==3.5.2 (from -r requirements.txt (line 8)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2a/0d/bebf456dd3b5bb4ecd78cb1e78636f38716384529d083ed78327ba49ec83/matplotlib-3.5.2-cp38-cp38-win_amd64.whl (7.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.2/7.2 MB 35.4 MB/s eta 0:00:00 Collecting numpy==1.21.6 (from -r requirements.txt (line 9)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/48/5f/db4550e1c68206814a577ebd92c0dd082f3628fd7fc96725d44a521b0c92/numpy-1.21.6-cp38-cp38-win_amd64.whl (14.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.0/14.0 MB 31.2 MB/s eta 0:00:00 Collecting opencv-python==4.5.2.54 (from -r requirements.txt (line 10)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/3e/ae/f0629a78fc5b631280664a91de8d2cee6e418790fec064e656897508fd33/opencv_python-4.5.2.54-cp38-cp38-win_amd64.whl (34.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 34.7/34.7 MB 31.2 MB/s eta 0:00:00 Collecting packaging==21.3 (from -r requirements.txt (line 11)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl (40 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.8/40.8 kB ? eta 0:00:00 Collecting pefile==2022.5.30 (from -r requirements.txt (line 12)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/48/30/4559d06bad5bb627733dac1ef28c34f5e35f1461247ba63e5f6366901277/pefile-2022.5.30.tar.gz (72 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 72.9/72.9 kB ? eta 0:00:00 Preparing metadata (setup.py) ... done Collecting Pillow==9.1.1 (from -r requirements.txt (line 13)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/71/54/bc24063ddb7ebb0962db41167971737f52351628907cf5c846f87d3501fc/Pillow-9.1.1-cp38-cp38-win_amd64.whl (3.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 41.4 MB/s eta 0:00:00 Collecting pyinstaller==5.1 (from -r requirements.txt (line 14)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/39/0c/fcedab1fc19e4a7b275c5298bb9c69e411d5092ceaf5a167b611de4c023d/pyinstaller-5.1-py3-none-win_amd64.whl (1.2 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 24.5 MB/s eta 0:00:00 Collecting pyinstaller-hooks-contrib==2022.7 (from -r requirements.txt (line 15)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/de/97/9901350320f0454a04a937666235f532353c55507679cca9712464760431/pyinstaller_hooks_contrib-2022.7-py2.py3-none-any.whl (234 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 234.3/234.3 kB ? eta 0:00:00 Collecting pyparsing==3.0.9 (from -r requirements.txt (line 16)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6c/10/a7d0fa5baea8fe7b50f448ab742f26f52b80bfca85ac2be9d35cdd9a3246/pyparsing-3.0.9-py3-none-any.whl (98 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.3/98.3 kB ? eta 0:00:00 Collecting PyQt5==5.15.6 (from -r requirements.txt (line 17)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/be/f2/8e7b751d102ce3500cbeff97cb514eaf5c06d5e423676c37e9de28d0c06b/PyQt5-5.15.6-cp36-abi3-win_amd64.whl (6.7 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.7/6.7 MB 35.8 MB/s eta 0:00:00 Requirement already satisfied: PyQt5-Qt5==5.15.2 in d:\ocr\aw\.venv\lib\site-packages (from -r requirements.txt (line 18)) (5.15.2) Collecting PyQt5-sip==12.10.1 (from -r requirements.txt (line 19)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/39/d0/cf2b613a3309397013e7781f2cdb4b1e0661ae635d88b75b6f481ec43d8c/PyQt5_sip-12.10.1-cp38-cp38-win_amd64.whl (77 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 77.5/77.5 kB ? eta 0:00:00 Collecting python-dateutil==2.8.2 (from -r requirements.txt (line 20)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB ? eta 0:00:00 Collecting pywin32-ctypes==0.2.0 (from -r requirements.txt (line 21)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/9e/4b/3ab2720f1fa4b4bc924ef1932b842edf10007e4547ea8157b0b9fc78599a/pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB) Collecting six==1.16.0 (from -r requirements.txt (line 22)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB) Collecting typing_extensions==4.2.0 (from -r requirements.txt (line 23)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/75/e1/932e06004039dd670c9d5e1df0cd606bf46e29a28e65d5bb28e894ea29c9/typing_extensions-4.2.0-py3-none-any.whl (24 kB) Collecting zipp==3.8.0 (from -r requirements.txt (line 24)) Downloading https://pypi.tuna.tsinghua.edu.cn/packages/80/0e/16a7ee38617aab6a624e95948d314097cc2669edae9b02ded53309941cfc/zipp-3.8.0-py3-none-any.whl (5.4 kB) Requirement already satisfied: setuptools in d:\ocr\aw\.venv\lib\site-packages (from pyinstaller==5.1->-r requirements.txt (line 14)) (68.2.0) Building wheels for collected packages: dlib, pefile Building wheel for dlib (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [60 lines of output] running bdist_wheel running build running build_py running build_ext C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\dlib_85a29ad4d6b343a9b32725056a86ae46\setup.py:129: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. if LooseVersion(cmake_version) < '3.1.0': Building extension for Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\dlib_85a29ad4d6b343a9b32725056a86ae46\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\d lib_85a29ad4d6b343a9b32725056a86ae46\build\lib.win-amd64-cpython-38 -DPYTHON_EXECUTABLE=D:\OCR\AW\.venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\dlib_85a29ad4d6b343a9b32725056a86ae46\build\lib.win-amd64-cpython-38 -A x64' -- Building for: Visual Studio 17 2022 CMake Error at CMakeLists.txt:2 (CMAKE_MINIMUM_REQUIRED): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\dlib_85a29ad4d6b343a9b32725056a86ae46\setup.py", line 222, in <module> setup( File "D:\OCR\AW\.venv\lib\site-packages\setuptools\__init__.py", line 103, in setup return distutils.core.setup(**attrs) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\core.py", line 185, in setup return run_commands(dist) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\core.py", line 201, in run_commands dist.run_commands() File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\OCR\AW\.venv\lib\site-packages\wheel\bdist_wheel.py", line 364, in run self.run_command("build") File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run self.run_command(cmd_name) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\dist.py", line 1001, in run_command super().run_command(command) File "D:\OCR\AW\.venv\lib\site-packages\setuptools\_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\dlib_85a29ad4d6b343a9b32725056a86ae46\setup.py", line 134, in run self.build_extension(ext) File "C:\Users\Admin\AppData\Local\Temp\pip-install-ok58xrc7\dlib_85a29ad4d6b343a9b32725056a86ae46\setup.py", line 171, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-ok58xrc7\\dlib_85a29ad4d6b343a9b32725056a86ae46\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\AppD ata\\Local\\Temp\\pip-install-ok58xrc7\\dlib_85a29ad4d6b343a9b32725056a86ae46\\build\\lib.win-amd64-cpython-38', '-DPYTHON_EXECUTABLE=D:\\OCR\\AW\\.venv\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-ok58xrc7\\dlib_85a29ad4d6b343a9b32725056a86ae46\\build\\lib.win-amd64-cpython-38', '-A', 'x64']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for dlib Running setup.py clean for dlib Building wheel for pefile (setup.py) ... done Created wheel for pefile: filename=pefile-2022.5.30-py3-none-any.whl size=69374 sha256=eb0fce74afadb696c631e077df35f2c9b633f4fa43fde26513600f71fd52c328 Stored in directory: c:\users\admin\appdata\local\pip\cache\wheels\c4\4d\66\e942afd74979c2f27949124de958fd59b790f2561e9d8ad952 Successfully built pefile Failed to build dlib ERROR: Could not build wheels for dlib, which is required to install pyproject.toml-based projects [notice] A new release of pip is available: 23.2.1 -> 25.0.1 [notice] To update, run: python.exe -m pip install --upgrade pip (.venv) PS D:\OCR\AW> 这是什么错误
06-13
Processing /home/luli/DH-PTAM-master/pangolin Preparing metadata (setup.py) ... done Building wheels for collected packages: pangolin Building wheel for pangolin (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [41 lines of output] running bdist_wheel running build running build_py /home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` directly. Instead, use pypa/build, pypa/installer or other standards-based tools. See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details. ******************************************************************************** !! self.initialize_options() installing to build/bdist.linux-x86_64/wheel running install copying ./pangolin.cpython-38-x86_64-linux-gnu.so -> / Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/home/luli/DH-PTAM-master/pangolin/setup.py", line 30, in <module> setup( File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/__init__.py", line 117, in setup return distutils.core.setup(**attrs) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 183, in setup return run_commands(dist) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 199, in run_commands dist.run_commands() File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands self.run_command(cmd) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/dist.py", line 999, in run_command super().run_command(command) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 973, in run_command cmd_obj.run() File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/command/bdist_wheel.py", line 461, in run self.egg2dist(self.egginfo_dir, distinfo_dir) File "/home/luli/anaconda3/envs/dhptam/lib/python3.8/site-packages/setuptools/command/bdist_wheel.py", line 590, in egg2dist raise ValueError(err) ValueError: Egg metadata expected at build/bdist.linux-x86_64/wheel/./pangolin-0.0.1-py3.8.egg-info but not found [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pangolin Running setup.py clean for pangolin Failed to build pangolin ERROR: Failed to build installable wheels for some pyproject.toml based projects (pangolin) (dhptam) luli@l
05-21
<think>我们正在解决构建QtQml时出现的错误:ProjectERROR:BuildingQtQmlrequiresPython。根据引用[1]和引用[4],这个错误是因为在构建QtQml时系统没有找到Python(可能是Python2)导致的。解决方案步骤:1.确保系统安装了Python2。在Ubuntu22.04上,默认可能没有安装Python2,需要手动安装。可以通过以下命令安装Python2:sudoaptinstallpython22.安装后,需要确保构建系统能够找到python2。由于Ubuntu22.04默认的python命令指向的是Python3,因此需要创建一个符号链接或者使用别名让python指向python2。根据引用[4]中提到的方法,可以创建一个软链接(但注意这可能会影响系统其他依赖python3的程序)或者使用别名(alias)在构建环境中临时将python指向python2。方法一:创建软链接(不推荐,因为可能破坏系统默认的python3环境)sudoln-s/usr/bin/python2/usr/bin/python方法二:在构建环境中临时使用别名(推荐)在构建之前,在终端中执行:aliaspython='/usr/bin/python2'方法三:修改构建脚本,在构建QtQml时指定Python解释器的路径。在配置Qt时,可以通过设置环境变量来指定Python路径,例如:exportPYTHON=/usr/bin/python23.另外,引用[4]还提到了在.bashrc文件中设置别名,这样每次打开终端都会生效。但同样要注意,这可能会影响其他需要python3的程序。编辑~/.bashrc文件,在末尾添加:aliaspython='/usr/bin/python2'然后执行:source~/.bashrc4.如果上述方法都不行,可以尝试在Qt的配置命令中明确指定Python的路径。例如,在配置Qt时加入:-python/usr/bin/python25.重新运行构建。注意:根据引用[1],错误信息中显示“python:notfound”,所以确保安装python2后,在终端输入“python2”可以运行。然后通过上述方法之一让构建系统能够调用到python2。另外,引用[2]和引用[3]分别提供了关于Qt环境变量设置和Mac上Xcode配置的参考,但当前问题主要是缺少Python2,所以重点参考引用[1]和[4]。如果是在其他Linux发行版或Mac上,同样需要确保Python2已安装并可被找到。在Mac上,如果同时安装了Python2和Python3,通常python命令可能指向Python2(取决于安装方式),也可能没有。可以通过brew安装python2,然后创建软链接或设置别名。总结:核心是确保构建QtQml时,系统能够调用到Python2解释器。§§相关问题§§1.如何在Ubuntu22.04上安装Python2并设置为默认?2.如何在不改变系统默认Python版本的情况下为特定项目指定Python解释器?3.在构建Qt时,还有哪些常见的依赖问题需要注意?</think>### 解决构建QtQml时的Python依赖错误 出现`Project ERROR: Building QtQml requires Python`错误的原因是QtQml模块在编译时需要Python 2解释器,但系统未正确配置或缺失Python 2环境。以下是逐步解决方案: --- #### **1. 安装Python 2** 在终端执行: ```bash sudo apt update sudo apt install python2 ``` 验证安装: ```bash python2 --version # 应输出Python 2.x.x ``` --- #### **2. 创建Python 2的符号链接**(关键步骤) 由于Qt构建脚本默认调用`python`命令,需将其指向Python 2: ```bash sudo ln -s /usr/bin/python2 /usr/bin/python # 创建系统级软链接 ``` > **注意**:此操作会临时覆盖默认Python命令。完成后可通过`sudo unlink /usr/bin/python`恢复。 --- #### **3. 配置环境变量**(可选) 在构建前设置Python路径变量: ```bash export PYTHON=/usr/bin/python2 # 显式指定Python解释器路径 ``` --- #### **4. 重新构建Qt** 清理旧构建并重试: ```bash make distclean # 清理旧构建 ./configure -prefix $YOUR_QT_PATH # 重新配置 make module-qtdeclarative # 单独构建QtQml模块 ``` > 若仍失败,尝试完整构建:`make -j$(nproc)` --- ### **替代方案:使用虚拟环境** 若需保留系统默认Python 3,使用虚拟环境: ```bash # 创建Python 2虚拟环境 virtualenv -p /usr/bin/python2 qtbuild_env source qtbuild_env/bin/activate # 在虚拟环境中构建Qt ./configure && make deactivate # 完成后退出 ``` --- ### **错误原因分析** - QtQml的代码生成工具(如`qmlcachegen`)依赖Python 2脚本[^1]。 - Ubuntu 22.04默认移除Python 2,导致构建系统找不到解释器[^4]。 - 未正确设置`python`命令的指向是常见触发原因[^1][^4]。 --- ### **验证修复** 检查Qt构建日志中是否出现以下关键行: ``` Checking for Python... /usr/bin/python2 (found) Building qmlcachegen... OK ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值