Ishin 发表于 2020-12-12 16:19

Python 未设置环境变量下,如何在CMD调用pip安装的库

本帖最后由 Ishin 于 2020-12-12 16:22 编辑

点进来的热心人士,先感谢啦~!
题主在公司电脑用免安装版的python,没有配置环境变量
(别问,问就是没有权限,无法安装exe版和配置环境变量,不然我也不用这么麻烦。)


1.已经安装了pip和pyinstaller和auto-py-to-exe了
C:\Users\28142749>pip install pyinstaller
Requirement already satisfied: pyinstaller in c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (4.1)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pyinstaller) (2020.10)
Requirement already satisfied: altgraph in c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: setuptools in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.8_3.8.1776.0_x64__qbz5n2kfra8p0\lib\site-packages (from pyinstaller) (49.2.1)
Requirement already satisfied: pywin32-ctypes>=0.2.0; sys_platform == "win32" in c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: pefile>=2017.8.1; sys_platform == "win32" in c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pyinstaller) (2019.4.18)
Requirement already satisfied: future in c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from pefile>=2017.8.1; sys_platform == "win32"->pyinstaller) (0.18.2)

2. 尝试 运行这些库(可执行程序)
D:\Output>pyinstaller -F file_creator.py
'pyinstaller' is not recognized as an internal or external command,
operable program or batch file.

3. 并没有安装失败
D:\Output>pip list
Package                   Version
------------------------- ---------
.......
pyinstaller               4.1
pyinstaller-hooks-contrib 2020.10
........

4. 尝试绝对路径?
D:\Output>pip show pyinstaller
Name: pyinstaller
Version: 4.1
Location: c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages
Requires: pefile, pywin32-ctypes, setuptools, pyinstaller-hooks-contrib, altgraph
Required-by: auto-py-to-exe

D:\Output>c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\pyinstaller
'c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\pyinstaller' is not recognized as an internal or external command,
operable program or batch file.

D:\Output>c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\pyinstaller.exe
'c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\pyinstaller.exe' is not recognized as an internal or external command,
operable program or batch file.

D:\Output>c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\pyinstaller.py
'c:\users\28142749\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages\pyinstaller.py' is not recognized as an internal or external command,
operable program or batch file.

5. 以上就是我分析,尝试自己努力解决问题的全部流程。所以我觉得自己暂时的能力,搞不定,有人能够告诉我,怎么样可以使用pyinstaller吗
应该排版不至于太丑不想看吧?

SagJoker 发表于 2020-12-12 16:40

我曾经见过打包好的pyinstaller。

wty1641 发表于 2020-12-12 16:42

python绝对路径\python.exe -m pip +正常命令

feiyu361 发表于 2020-12-13 11:07

你要指定好你的路径
页: [1]
查看完整版本: Python 未设置环境变量下,如何在CMD调用pip安装的库