Обновление 4
После перезагрузки компьютера все работает нормально.
Обновление 3
Я все еще не могу получить -auto-py-to-exe - на работу.
Я все еще получаю эту ошибку.
C:\Users\HP>auto-py-to-exe
'auto-py-to-exe' is not recognized as an internal or external command,
operable program or batch file.
Вот еще один код, который может или не может служить руководством.
C:\Users\HP>pip
Usage:
pip <command> [options]
Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
config Manage local and global configuration.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
--no-color Suppress colored output
Я смотрел https://www.youtube.com/watch?v=cm6WDGAzDPM&feature=youtu.be и читал это https://nitratine.net/blog/post/issues-when-using-auto-py-to-exe/ и это https://nitratine.net/blog/post/fix-python-is-not-recognized-as-an-internal-or-external-command/.
Вот код, связанный с видео на YouTube -
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>> print (os.path.dirname(sys.executable) + '\Scripts\\')
C:\Users\HP\AppData\Local\Programs\Python\Python37-32\Scripts\
>>>
Под пользовательскими переменными для HP у меня теперь есть
C:\Users\HP\AppData\Local\Programs\Python\Python37-32\Scripts\
Я запустил этот скрипт (скопированный с nitratine.net), но это не помогло.
import sys
import subprocess
import os
INFO = '[INFO] '
OK = '[OK] '
ACTION = '[ACTION] '
WARN = '[WARN] '
ERROR = '[ERROR] '
def get_path():
""" Get the users PATH environment variable """
p = subprocess.Popen(
['powershell.exe', '[Environment]::GetEnvironmentVariable("PATH", "User")'],
stdout=subprocess.PIPE,
shell=True
)
out, err = p.communicate()
return out.decode('utf-8').strip() # Get \n\r off
def folder_path_in_path_variable(target_path, path_list):
""" Check if the target path is in a list of paths (looks for path\ also) """
return target_path in path_list or target_path + '\\' in path_list
def add_path(_path):
""" Add a path to the users PATH environment variable """
# Get path value and check if it already contains the path
current_path_value = get_path()
if _path in current_path_value.split(';'):
return True
# Setup new path value
new_path_value_to_set = current_path_value
if not new_path_value_to_set.endswith(';'):
new_path_value_to_set += ';'
new_path_value_to_set += _path
# Set new path value
p = subprocess.Popen(['powershell.exe', '[Environment]::SetEnvironmentVariable("PATH", "{0}", "User")'.format(new_path_value_to_set)], stdout=subprocess.PIPE, shell=True)
p.wait()
# Check that it was set
new_path_value = get_path()
return _path in new_path_value.split(';')
# Give information about what we know
print(INFO + 'This script is running on Python {0}.{1}.{2}'.format(sys.version_info.major, sys.version_info.minor, sys.version_info.micro))
print(INFO + 'The executable running this script is at: {0}'.format(sys.executable))
print(INFO + 'Python installation root is at: {0}'.format(sys.exec_prefix))
if sys.exec_prefix != sys.base_exec_prefix:
print(WARN + 'It looks like you\'re using a virtualenv. We\'ll try to add the base Python version to make things easier.')
print('')
# Get current user path variable
path_variable = get_path()
path_variable_paths = [i for i in path_variable.split(';') if i != '']
print(INFO + 'Current user PATH variable contains:')
for path in path_variable_paths:
print('\t{0}'.format(path))
# Check if the installation root is in the variable
if folder_path_in_path_variable(sys.base_exec_prefix, path_variable_paths):
print(OK + 'Python installation root path is in the users PATH variable')
base_path_addition_required = False
else:
print(ACTION + 'Python installation root path is not in the users PATH variable')
base_path_addition_required = True
# Check if the scripts folder is in the variable (first make sure it exists)
scripts_folder_location = sys.base_exec_prefix + '\\Scripts'
if os.path.isdir(scripts_folder_location):
if scripts_folder_location in path_variable or scripts_folder_location + '\\' in path_variable:
print(OK + 'Scripts folder path is in the users PATH variable')
scripts_path_addition_required = False
else:
print(ACTION + 'Scripts folder path is not in the users PATH variable')
scripts_path_addition_required = True
else:
print(WARN + 'Cannot locate Scripts folder at {0}'.format(scripts_folder_location))
scripts_path_addition_required = False
# If anything needs to be added, check with the user first
if base_path_addition_required or scripts_path_addition_required:
answer = input('Do you want to add the required paths to the users path environment variable? ')
# If they say yes, add the required paths
if answer.lower() in ['yes', 'y']:
changed = False
print('')
# Add the Python root
if base_path_addition_required:
if add_path(sys.base_exec_prefix):
print(OK + 'Successfully added the Python installation root path to the users PATH variable')
changed = True
else:
print(ERROR + 'Failed to add the Python installation root path to the users PATH variable')
# Add the Scripts path
if scripts_path_addition_required:
if add_path(scripts_folder_location):
print(OK + 'Successfully added the Scripts folder path to the users PATH variable')
changed = True
else:
print(ERROR + 'Failed to add the Scripts folder path to the users PATH variable')
# If anything was changed, notify the user they need to restart applications to get it
if changed:
print('')
print(WARN + 'You will need to restart applications to get the new path variable value')
else:
input(INFO + 'No action required')
Обновление 2
Я обновил PIP
Microsoft Windows [Версия 10.0.17134.165] (c) 2018 Microsoft Corporation. Все права защищены.
C:\Users\HP>python --version
Python 3.7.3
C:\Users\HP>curl https://bootstrap.pypa.io/get-pip.py | python
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1733k 100 1733k 0 0 866k 0 0:00:02 0:00:02 --:--:-- 739k
Collecting pip
Downloading https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl (1.4MB)
|████████████████████████████████| 1.4MB 1.3MB/s
Installing collected packages: pip
Found existing installation: pip 19.1.1
Uninstalling pip-19.1.1:
Successfully uninstalled pip-19.1.1
Successfully installed pip-19.2.3
Обновление 1
Я читаю это https://www.datacamp.com/community/tutorials/pip-python-package-manager#targetText=Pip%20is%20one%20of%20the,or%20%22Pip%20Installs%20Python%22. для поддержки.
ОригиналКомментарий
Я хочу преобразовать py в exe, потому что на моем клиенте не установлено программное обеспечение разработчика Python.
Я загрузил auto-py-to-exe-2.6.5.tar.gz (64,0 КБ) из https://pypi.org/project/auto-py-to-exe/#files
Папка сохраняется в - C: \ Users \ HP \Загрузки
Папка называется - auto-py-to-exe-2.6.5
Я попробовал это -
I pressed windows key + R and then typed in CMD
Microsoft Windows [Version 10.0.17134.165]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\HP>pip install auto-py-to-exe
'pip' is not recognized as an internal or external command,
operable program or batch file.
Я попробовал это -
I loaded Python 3.7 (32 bit)
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> pip install auto-py-to-exe
То, что я делаю, кажется неправильным. Мне кажется, что я пропускаю шаги, но не нахожу руководства для разработчиков удаленно полезными.