【问题标题】:Offline Installer for Visual Studio 14 for pyodbc package / offline pyodbc installationVisual Studio 14 的离线安装程序,用于 pyodbc 包/离线 pyodbc 安装
【发布时间】:2020-09-05 22:36:16
【问题描述】:

我在没有互联网连接的 Windows 服务器上安装了 python。

现在我想通过 python 连接到服务器上的 SQL Server 数据库,因此想安装 PyODBC。 我从他们的网站下载了 pyodbc-4.0.17.tar.gz 从本地 Windows 连接互联网,上传到服务器并尝试通过命令行通过 pip install 安装它,但收到以下错误消息:

  ERROR: Command errored out with exit status 1:
     command: 'c:\users\a2289770-3\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tok
enize; sys.argv[0] = '"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-agil8hty\\setup.py'"'"'; __file__=
'"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-agil8hty\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"
'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exe
c'"'"'))' install --record 'C:\Users\A22897~1\AppData\Local\Temp\3\pip-record-hfui07d3\install-record.txt' --single-vers
ion-externally-managed --compile --install-headers 'c:\users\a2289770-3\appdata\local\programs\python\python37\Include\p
yodbc'
         cwd: C:\Users\A22897~1\AppData\Local\Temp\3\pip-req-build-agil8hty\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.micr
osoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\a2289770-3\appdata\local\programs\python\python37\python.exe' -
u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-a
gil8hty\\setup.py'"'"'; __file__='"'"'C:\\Users\\A22897~1\\AppData\\Local\\Temp\\3\\pip-req-build-agil8hty\\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\A22897~1\AppData\Local\Temp\3\pip-record-hfui07d3\
install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\a2289770-3\appdata\local\p
rograms\python\python37\Include\pyodbc' Check the logs for full command output.

所以我尝试安装 Visual C++ 14,但我尝试的所有安装包都尝试连接到 Internet,因此在安装过程中停止。

有人可以帮忙吗?

【问题讨论】:

    标签: python pyodbc offline


    【解决方案1】:

    好的,我在这里找到了解决方案:How to install packages offline?

    • 通过pip freeze > requirements.txt创建 requirements.txt 包括所有需要的包

    • 通过互联网连接将所有包及其依赖项下载到本地 Windows 上的目录中 - 还包括 requirements.txt 那里(在我的情况下,通过pip download“操舵室”,有关详细信息,请参阅链接)

    • 将该目录上传到服务器

    • 使用以下命令安装

      pip install -r wheelhouse/requirements.txt --no-index --find-links wheelhouse

    现在我可以在离线服务器上使用pyodbc了。

    我觉得奇怪的是,它以前需要 Microsoft Visual C++ 14.0,但现在我没有安装它,但无论如何……如果有人知道原因,我会感兴趣在 cmets 中阅读它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-22
      • 2018-11-16
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2013-07-16
      • 1970-01-01
      相关资源
      最近更新 更多