簡體   English   中英

Visual Studio 14 的離線安裝程序,用於 pyodbc 包/離線 pyodbc 安裝

[英]Offline Installer for Visual Studio 14 for pyodbc package / offline pyodbc installation

我在沒有互聯網連接的 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,因此在安裝過程中停止。

有人可以幫忙嗎?

好的,我在這里找到了解決方案: 如何離線安裝軟件包?

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

  • 將所有軟件包及其依賴項下載到具有 Internet 連接的本地 Windows 上的目錄中 - 還包括 requirements.txt (在我的情況下,通過pip download “wheelhouse”,有關詳細信息,請參閱鏈接)

  • 將該目錄上傳到服務器

  • 使用以下命令安裝

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

現在我可以在離線服務器上使用 pyodbc 了。

我覺得很奇怪,它以前需要 Microsoft Visual C++ 14.0,現在可以在我沒有安裝它的情況下工作,但是無論如何……如果有人知道這樣做的原因,我會很想在評論中閱讀它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM