简体   繁体   English

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

[英]How to install pyinstaller without internet connection?

I am trying to install Pyinstaller without an internet connection.我正在尝试在没有互联网连接的情况下安装 Pyinstaller。 I am trying to install inside virtual environment folder( venv ) there it contains all the packages installed.我正在尝试安装在虚拟环境文件夹( venv )中,它包含所有已安装的软件包。 I have installed all packages using '.whl' files.我已经使用“.whl”文件安装了所有软件包。

Whenever I run this command in cmd:每当我在 cmd 中运行此命令时:

pip install PyInstaller-3.5.tar.gz

I got this error:我收到此错误:

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

I have got error regarding setuptools, but I have installed setuptools 40.6.3 inside venv How to fix this?我有关于 setuptools 的错误,但我已经在 venv 中安装了 setuptools 40.6.3 如何解决这个问题?

For installing a python package from a source you need to first extract it, change the current directory to extracted directory and then run python setup.py install inside the directory to build and install the package on your current environment.要从源安装 python 包,您需要先解压它,将当前目录更改为解压目录,然后在目录中运行python setup.py install以在当前环境中构建和安装包。

Anyway, PyInstaller needs some external packages that you need to install them by getting their source or using a wheel package.无论如何,PyInstaller 需要一些外部包,您需要通过获取它们的源代码或使用wheel 包来安装它们。 Here is the order you should install first (if you install them with source use the above command):这是您应该首先安装的顺序(如果您使用源代码安装它们,请使用上述命令):

future未来

pefile pefile

pywin32_ctypes pywin32_ctypes

altgraph山寨图

Finally, extract PyInstaller source zip file, change your current directory and run below command in terminal:最后,提取 PyInstaller 源 zip 文件,更改当前目录并在终端中运行以下命令:

python setup.py install

To test it use:要测试它,请使用:

pyintaller script_name.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM