如何在没有互联网连接的情况下安装pyinstaller?

时间:2019-07-19 10:00:10

标签: python pyinstaller

我正在尝试在没有Internet连接的情况下安装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 该如何解决?

1 个答案:

答案 0 :(得分:0)

要从源代码安装python软件包,您需要先将其解压缩,将当前目录更改为解压缩目录,然后在该目录中运行python setup.py install以在当前环境中构建并安装该软件包。

无论如何,PyInstaller需要一些外部软件包,您需要通过获取其源代码或使用wheel软件包来安装它们。这是您应该首先安装的顺序(如果使用源代码安装它们,请使用上面的命令):

  

future

     

pefile

     

pywin32_ctypes

     

altgraph

最后,解压缩PyInstaller源zip文件,更改当前目录并在终端中运行以下命令:

python setup.py install

要进行测试,请使用:

pyintaller script_name.py