在 Visual Studio Code 中安装 GUI wxPython

问题描述 投票:0回答:0

我正在尝试在 VisualStudioCode 中安装 wxPython,但它无法正常工作。我将在此处插入它给我的代码:

 pip install wxPython==4.1.1
>>
Collecting wxPython==4.1.1
  Using cached wxPython-4.1.1.tar.gz (66.0 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pillow in c:\users\kamil\myenv\lib\site-packages (from wxPython==4.1.1) (9.4.0)
Requirement already satisfied: six in c:\users\kamil\myenv\lib\site-packages (from wxPython==4.1.1) (1.16.0)
Requirement already satisfied: numpy in c:\users\kamil\myenv\lib\site-packages (from wxPython==4.1.1) (1.24.2)
Installing collected packages: wxPython
  DEPRECATION: wxPython is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for wxPython ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for wxPython did not run successfully.
  │ exit code: 1
  ╰─> [43 lines of output]
      C:\Users\kamil\myenv\Lib\site-packages\setuptools\dist.py:771: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
        warnings.warn(
      C:\Users\kamil\myenv\Lib\site-packages\setuptools\config\setupcfg.py:508: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)
      C:\Users\kamil\myenv\Lib\site-packages\setuptools\dist.py:317: DistDeprecationWarning: use_2to3 is ignored.
        warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
      running install
      C:\Users\kamil\myenv\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      Will build using: "C:\Users\kamil\myenv\Scripts\python.exe"
      3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)]
      Python's architecture is 64bit
      cfg.VERSION: 4.1.1
      
      Running command: build
      Running command: build_wx
      Command '"C:\Users\kamil\myenv\Scripts\python.exe" -c "import setuptools, distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); print(mc.cc)"' failed with exit code 1.
      Traceback (most recent call last):
      
        File "<string>", line 1, in <module>

        File "C:\Users\kamil\myenv\Lib\site-packages\setuptools\_distutils\msvc9compiler.py", line 403, in initialize
      
          vc_env = query_vcvarsall(VERSION, plat_spec)
      
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

        File "C:\Users\kamil\myenv\Lib\site-packages\setuptools\_distutils\msvc9compiler.py", line 281, in query_vcvarsall     

          raise DistutilsPlatformError("Unable to find vcvarsall.bat")
      
      distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
      Finished command: build_wx (0m3.681s)
      Finished command: build (0m3.681s)
      WARNING: Building this way assumes that all generated files have been
      generated already.  If that is not the case then use build.py directly
      to generate the source and perform the build stage.  You can use
      --skip-build with the bdist_* or install commands to avoid this
      message and the wxWidgets and Phoenix build steps in the future.

      "C:\Users\kamil\myenv\Scripts\python.exe" -u build.py build
      Command '"C:\Users\kamil\myenv\Scripts\python.exe" -u build.py build' failed with exit code 1.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> wxPython

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
(myenv) PS C:\Users\kamil> pip install Python
ERROR: Could not find a version that satisfies the requirement Python (from versions: none)
ERROR: No matching distribution found for Python
(myenv) PS C:\Users\kamil> pip install wxPython
Collecting wxPython
  Using cached wxPython-4.2.0.tar.gz (71.0 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\kamil\AppData\Local\Temp\pip-install-xyqp1l_l\wxpython_2ac19af48cc24089ac12af82f2dc20f0\setup.py", line 27, in <module>
          from buildtools.config import Config, msg, opj, runcmd, canGetSOName, getSOName
        File "C:\Users\kamil\AppData\Local\Temp\pip-install-xyqp1l_l\wxpython_2ac19af48cc24089ac12af82f2dc20f0\buildtools\config.py", line 30, in <module>
          from attrdict import AttrDict
        File "C:\Users\kamil\myenv\Lib\site-packages\attrdict\__init__.py", line 5, in <module>
          from attrdict.mapping import AttrMap
        File "C:\Users\kamil\myenv\Lib\site-packages\attrdict\mapping.py", line 4, in <module>
          from collections import Mapping
      ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\kamil\AppData\Local\Programs\Python\Python311\Lib\collections\__init__.py)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

我也做过 pip 安装属性 pip 安装 wxPython==4.1.1

现在是 2023 年 3 月,我在尝试构建应用程序时来这里寻求帮助。我使用聊天 GPT 来帮助我。

我正在网上寻求帮助,但很难找到可以帮助真人构建东西的东西。

哇,它仍然说我的帖子主要是代码,我需要添加更多细节。这从一开始就非常烦人。下一步是什么?

python visual-studio-code wxpython
© www.soinside.com 2019 - 2024. All rights reserved.