簡體   English   中英

如何在沒有互聯網連接的情況下安裝 pyinstaller?

[英]How to install pyinstaller without internet connection?

我正在嘗試在沒有互聯網連接的情況下安裝 Pyinstaller。 我正在嘗試安裝在虛擬環境文件夾( venv )中,它包含所有已安裝的軟件包。 我已經使用“.whl”文件安裝了所有軟件包。

每當我在 cmd 中運行此命令時:

pip install PyInstaller-3.5.tar.gz

我收到此錯誤:

Processing f:\test\venv\pyinstaller-3.5.tar.gz
  Installing build dependencies ... error
  Complete output from command f:\test\venv\scripts\python.exe f:\test\venv\lib\site-packages\pip install --ignore-installed --no-user --prefix C:
\Users\hello\AppData\Local\Temp\pip-build-env-e63w3s81\overlay --no-warn-script-l
ocation --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- se
tuptools>=40.2.0 wheel:
  Collecting setuptools>=40.2.0
    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D11D0>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D1330>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti

on.VerifiedHTTPSConnection object at 0x037D17B0>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D1590>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None
)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connecti
on.VerifiedHTTPSConnection object at 0x037D1F30>, 'Connection to pypi.org timed
out. (connect timeout=15)')': /simple/setuptools/
    Could not find a version that satisfies the requirement setuptools>=40.2.0 (
from versions: )
  No matching distribution found for setuptools>=40.2.0

  ----------------------------------------
Command "f:\test\venv\scripts\python.exe f:\test\venv\lib\site-pac
kages\pip install --ignore-installed --no-user --prefix C:\Users\hello\AppData\Lo
cal\Temp\pip-build-env-e63w3s81\overlay --no-warn-script-location --no-binary :n
one: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.2.0 wheel
" failed with error code 1 in None

我有關於 setuptools 的錯誤,但我已經在 venv 中安裝了 setuptools 40.6.3 如何解決這個問題?

要從源安裝 python 包,您需要先解壓它,將當前目錄更改為解壓目錄,然后在目錄中運行python setup.py install以在當前環境中構建和安裝包。

無論如何,PyInstaller 需要一些外部包,您需要通過獲取它們的源代碼或使用wheel 包來安裝它們。 這是您應該首先安裝的順序(如果您使用源代碼安裝它們,請使用上述命令):

未來

pefile

pywin32_ctypes

山寨圖

最后,提取 PyInstaller 源 zip 文件,更改當前目錄並在終端中運行以下命令:

python setup.py install

要測試它,請使用:

pyintaller script_name.py

暫無
暫無

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

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