使用pip在Windows中安装ZeroMQ / pyzmq时出现问题

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

我是python的新手,我正在使用pip通过控制台安装软件包。与以前的安装效果很好,但是当我尝试安装pyzmq时,我收到一条错误消息。我以为问题已经解决了Cython(因为我以前见过类似的东西),但是后来我安装了Cython,问题仍然存在。这是我收到的完整消息:

    Collecting pyzmq
      Using cached https://files.pythonhosted.org/packages/7a/d2/1eb3a994374802b352d4911f3317313a5b4ea786bc830cc5e343dad9b06d/pyzmq-18.1.0.tar.gz
    Building wheels for collected packages: pyzmq
      Building wheel for pyzmq (setup.py) ... error
    ERROR: Command errored out with exit status 1:
       command: 'C:\Users\gianf\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"'; __file__='"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\gianf\AppData\Local\Temp\pip-wheel-hxgsq9q7' --python-tag cp38
           cwd: C:\Users\gianf\AppData\Local\Temp\pip-install-7scmlplo\pyzmq\
      Complete output (191 lines):
      running bdist_wheel
      running build
      running build_py
      Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar.txt
      Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar3.8.0.final.0.pickle
      Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\Grammar3.8.0.final.0.pickle'
      Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar.txt
      Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar3.8.0.final.0.pickle
      Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\PatternGrammar3.8.0.final.0.pickle'
      creating build
(((copying / creating a bunch of stuff I omitted to fit on the post)))
      copying zmq\utils\zmq_constants.h -> build\lib.win-amd64-3.8\zmq\utils
      running build_ext
      running configure
      {'libraries': ['libzmq'], 'include_dirs': [], 'library_dirs': [], 'runtime_library_dirs': [], 'extra_link_args': []}
      Warning: Couldn't find an acceptable libzmq on the system.

      If you expected pyzmq to link against an installed libzmq, please check to make sure:

          * You have a C compiler installed
          * A development version of Python is installed (including headers)
          * A development version of ZMQ >= 3.2 is installed (including headers)
          * If ZMQ is not in a default location, supply the argument --zmq=<path>
          * If you did recently install ZMQ to a default location,
            try rebuilding the ld cache with `sudo ldconfig`
            or specify zmq's location with `--zmq=/usr/local`

      You can skip all this detection/waiting nonsense if you know
      you want pyzmq to bundle libzmq as an extension by passing:

          `--zmq=bundled`

      I will now try to build libzmq as a Python extension
      unless you interrupt me (^C) in the next 10 seconds...

      ************************************************
       1...
      Using bundled libzmq
      already have bundled\zeromq
      staging platform.hpp from: C:\Users\gianf\AppData\Local\Temp\pip-install-7scmlplo\pyzmq\buildutils\include_win32
      error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
      ************************************************
      ----------------------------------------
      ERROR: Failed building wheel for pyzmq
      Running setup.py clean for pyzmq
    Failed to build pyzmq
    Installing collected packages: pyzmq
        Running setup.py install for pyzmq ... error
        ERROR: Command errored out with exit status 1:
         command: 'C:\Users\gianf\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"'; __file__='"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\gianf\AppData\Local\Temp\pip-record-7kjkoe_6\install-record.txt' --single-version-externally-managed --compile --user --prefix=
             cwd: C:\Users\gianf\AppData\Local\Temp\pip-install-7scmlplo\pyzmq\
        Complete output (193 lines):
        running install
        running build
        running build_py
        Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar.txt
        Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\Grammar3.8.0.final.0.pickle
        Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\Grammar3.8.0.final.0.pickle'
        Generating grammar tables from C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar.txt
        Writing grammar tables to C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\lib\lib2to3\PatternGrammar3.8.0.final.0.pickle
        Writing failed: [Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0\\lib\\lib2to3\\PatternGrammar3.8.0.final.0.pickle'
(((copying / creating a bunch of lines I omitted to fit on the post)))
        running build_ext
        running configure
        {'libraries': ['libzmq'], 'include_dirs': [], 'library_dirs': [], 'runtime_library_dirs': [], 'extra_link_args': []}
        Warning: Couldn't find an acceptable libzmq on the system.

        If you expected pyzmq to link against an installed libzmq, please check to make sure:

            * You have a C compiler installed
            * A development version of Python is installed (including headers)
            * A development version of ZMQ >= 3.2 is installed (including headers)
            * If ZMQ is not in a default location, supply the argument --zmq=<path>
            * If you did recently install ZMQ to a default location,
              try rebuilding the ld cache with `sudo ldconfig`
              or specify zmq's location with `--zmq=/usr/local`

        You can skip all this detection/waiting nonsense if you know
        you want pyzmq to bundle libzmq as an extension by passing:

            `--zmq=bundled`

        I will now try to build libzmq as a Python extension
        unless you interrupt me (^C) in the next 10 seconds...

         1...
        Using bundled libzmq
        already have bundled\zeromq
        already have platform.hpp
        building 'zmq.libzmq' extension
        error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
        ----------------------------------------
    ERROR: Command errored out with exit status 1: 'C:\Users\gianf\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"'; __file__='"'"'C:\\Users\\gianf\\AppData\\Local\\Temp\\pip-install-7scmlplo\\pyzmq\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\gianf\AppData\Local\Temp\pip-record-7kjkoe_6\install-record.txt' --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

因为我注意到有关MS C ++的错误,所以我基本上下载并安装了与Microsoft Visual C ++相关的所有内容,但该错误仍然存​​在。

也尝试通过msi文件安装pyzmq,但我不确定正确的路径。

https://i.stack.imgur.com/70SUb.jpg

python pip cython failed-installation pyzmq
1个回答
0
投票

我知道了!

我安装了Visual Studio,但这还不够。我也需要构建工具,更具体地说,安装过程中在可选软件包上具有“ C ++”的所有内容。之后,我可以毫无问题地安装软件包。

© www.soinside.com 2019 - 2024. All rights reserved.