Python环境安装参考:https://docs.microsoft.com/zh-cn/windows/python/beginners
在window10系统安装python模块包os_win
C:\Users\lixx>pip install os_win
Collecting os_win
Using cached os_win-5.0.0-py3-none-any.whl (272 kB)
Collecting pbr!=2.1.0,>=2.0.0
Using cached pbr-5.4.4-py2.py3-none-any.whl (110 kB)
Collecting oslo.log>=3.36.0
Using cached oslo.log-4.0.0-py2.py3-none-any.whl (72 kB)
Requirement already satisfied: PyMI>=1.0.0; sys_platform == "win32" in c:\users\lixx\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from os_win) (1.0.4)
Collecting oslo.concurrency>=3.26.0
Using cached oslo.concurrency-4.0.0-py2.py3-none-any.whl (46 kB)
Collecting eventlet!=0.18.3,!=0.20.1,>=0.18.2
Using cached eventlet-0.25.1-py2.py3-none-any.whl (222 kB)
Collecting oslo.config>=5.2.0
Using cached oslo.config-8.0.0-py2.py3-none-any.whl (125 kB)
Collecting oslo.utils>=3.33.0
Using cached oslo.utils-4.0.0-py2.py3-none-any.whl (100 kB)
Collecting oslo.i18n>=3.15.3
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000001E3A8107488>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)')': /packages/8b/c4/e8f5cf9269ea3d0b4afbe6b40871443ded752bedad591d8a107dae71c08c/oslo.i18n-4.0.0-py3-none-any.whl
Downloading oslo.i18n-4.0.0-py3-none-any.whl (47 kB)
|████████████████████████████████| 47 kB 153 kB/s
Collecting Babel!=2.4.0,>=2.3.4
Using cached Babel-2.8.0-py2.py3-none-any.whl (8.6 MB)
Requirement already satisfied: wmi>=0.5; sys_platform == "win32" in c:\users\lixx\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from os_win) (1.4.9)
Collecting oslo.serialization>=2.25.0
Downloading oslo.serialization-3.0.0-py3-none-any.whl (28 kB)
Collecting oslo.context>=2.20.0
Downloading oslo.context-3.0.0-py2.py3-none-any.whl (19 kB)
Collecting debtcollector>=1.19.0
Downloading debtcollector-2.0.0-py3-none-any.whl (23 kB)
Collecting six>=1.11.0
Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting python-dateutil>=2.7.0
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
|████████████████████████████████| 227 kB 939 kB/s
Requirement already satisfied: setuptools in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\lib\site-packages (from PyMI>=1.0.0; sys_platform == "win32"->os_win) (41.2.0)
Collecting fasteners>=0.7.0
Downloading fasteners-0.15-py2.py3-none-any.whl (23 kB)
Collecting greenlet>=0.3
Downloading greenlet-0.4.15-cp37-cp37m-win_amd64.whl (16 kB)
Collecting monotonic>=1.4
Downloading monotonic-1.5-py2.py3-none-any.whl (5.3 kB)
Collecting dnspython>=1.15.0
Downloading dnspython-1.16.0-py2.py3-none-any.whl (188 kB)
|████████████████████████████████| 188 kB 1.1 MB/s
Collecting netaddr>=0.7.18
Downloading netaddr-0.7.19-py2.py3-none-any.whl (1.6 MB)
|████████████████████████████████| 1.6 MB 252 kB/s
Collecting rfc3986>=1.2.0
Downloading rfc3986-1.3.2-py2.py3-none-any.whl (31 kB)
Collecting stevedore>=1.20.0
Downloading stevedore-1.32.0-py2.py3-none-any.whl (43 kB)
|████████████████████████████████| 43 kB 150 kB/s
Collecting requests>=2.18.0
Downloading requests-2.22.0-py2.py3-none-any.whl (57 kB)
|████████████████████████████████| 57 kB 326 kB/s
Collecting PyYAML>=3.12
Downloading PyYAML-5.3-cp37-cp37m-win_amd64.whl (215 kB)
|████████████████████████████████| 215 kB 726 kB/s
Collecting pyparsing>=2.1.0
Downloading pyparsing-2.4.6-py2.py3-none-any.whl (67 kB)
|████████████████████████████████| 67 kB 358 kB/s
Collecting iso8601>=0.1.11
Downloading iso8601-0.1.12-py2.py3-none-any.whl (12 kB)
Collecting netifaces>=0.10.4
Downloading netifaces-0.10.9-cp37-cp37m-win_amd64.whl (16 kB)
Collecting pytz>=2013.6
Downloading pytz-2019.3-py2.py3-none-any.whl (509 kB)
|████████████████████████████████| 509 kB 819 kB/s
Collecting msgpack>=0.5.2
Downloading msgpack-0.6.2-cp37-cp37m-win_amd64.whl (68 kB)
|████████████████████████████████| 68 kB 255 kB/s
Collecting wrapt>=1.7.0
Downloading wrapt-1.11.2.tar.gz (27 kB)
Collecting chardet<3.1.0,>=3.0.2
Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
|████████████████████████████████| 133 kB 939 kB/s
Collecting idna<2.9,>=2.5
Downloading idna-2.8-py2.py3-none-any.whl (58 kB)
|████████████████████████████████| 58 kB 187 kB/s
Collecting certifi>=2017.4.17
Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
|████████████████████████████████| 156 kB 819 kB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
Downloading urllib3-1.25.8-py2.py3-none-any.whl (125 kB)
|████████████████████████████████| 125 kB 939 kB/s
Installing collected packages: pbr, pytz, Babel, six, oslo.i18n, PyYAML, msgpack, netaddr, pyparsing, iso8601, netifaces, wrapt, debtcollector, oslo.utils, oslo.serialization, oslo.context, rfc3986, stevedore, chardet, idna, certifi, urllib3, requests, oslo.config, python-dateutil, oslo.log, monotonic, fasteners, oslo.concurrency, greenlet, dnspython, eventlet, os-win
WARNING: The script pbr.exe is installed in 'C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pybabel.exe is installed in 'C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Running setup.py install for wrapt ... done
WARNING: The script chardetect.exe is installed in 'C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts oslo-config-generator.exe and oslo-config-validator.exe are installed in 'C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script convert-json.exe is installed in 'C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script lockutils-wrapper.exe is installed in 'C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Babel-2.8.0 PyYAML-5.3 certifi-2019.11.28 chardet-3.0.4 debtcollector-2.0.0 dnspython-1.16.0 eventlet-0.25.1 fasteners-0.15 greenlet-0.4.15 idna-2.8 iso8601-0.1.12 monotonic-1.5 msgpack-0.6.2 netaddr-0.7.19 netifaces-0.10.9 os-win-5.0.0 oslo.concurrency-4.0.0 oslo.config-8.0.0 oslo.context-3.0.0 oslo.i18n-4.0.0 oslo.log-4.0.0 oslo.serialization-3.0.0 oslo.utils-4.0.0 pbr-5.4.4 pyparsing-2.4.6 python-dateutil-2.8.1 pytz-2019.3 requests-2.22.0 rfc3986-1.3.2 six-1.14.0 stevedore-1.32.0 urllib3-1.25.8 wrapt-1.11.2
PyMI-1.0.4安装问题解决:
报错一:
Collecting PyMI>=1.0.0; sys_platform == "win32" (from os_win)
Downloading https://files.pythonhosted.org/packages/13/09/5ec73a082c7f29a1722a18912987aa35aa611e3fc70197e6c0c331d09fa0/PyMI-1.0.4.zip (2.0MB)
|████████████████████████████████| 2.0MB 218kB/s
ERROR: Command errored out with exit status 1:
command: 'C:\Users\lixx\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lixx\\AppData\\Local\\Temp\\pip-install-ijwtjsoc\\PyMI\\setup.py'"'"'; __file__='"'"'C:\\Users\\lixx\\AppData\\Local\\Temp\\pip-install-ijwtjsoc\\PyMI\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\lixx\AppData\Local\Temp\pip-install-ijwtjsoc\PyMI\pip-egg-info'
cwd: C:\Users\lixx\AppData\Local\Temp\pip-install-ijwtjsoc\PyMI\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\lixx\AppData\Local\Temp\pip-install-ijwtjsoc\PyMI\setup.py", line 1, in <module>
import git
ModuleNotFoundError: No module named 'git'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
解决:
C:\Users\lixx>pip install GitPython
安装git:https://9c80a9f7765f4da5bb5baa78fdc41def.dd.cdntips.com/dl.softmgr.qq.com/original/Development/Git-2.25.0-64-bit.exe?mkey=5e454327712c54a1&f=1849&cip=113.44.114.84&proto=https
报错二:
Collecting PyMI>=1.0.0; sys_platform == "win32"
Using cached PyMI-1.0.4.zip (2.0 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\lixx\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\lixx\\AppData\\Local\\Temp\\pip-install-6m73naxv\\PyMI\\setup.py'"'"'; __file__='"'"'C:\\Users\\lixx\\AppData\\Local\\Temp\\pip-install-6m73naxv\\PyMI\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\lixx\AppData\Local\Temp\pip-install-6m73naxv\PyMI\pip-egg-info'
cwd: C:\Users\lixx\AppData\Local\Temp\pip-install-6m73naxv\PyMI\
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\lixx\AppData\Local\Temp\pip-install-6m73naxv\PyMI\setup.py", line 17, in <module>
version=get_git_version(),
File "C:\Users\lixx\AppData\Local\Temp\pip-install-6m73naxv\PyMI\setup.py", line 8, in get_git_version
return g.describe(tags=True)
File "C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\git\cmd.py", line 542, in <lambda>
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File "C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\git\cmd.py", line 1005, in _call_process
return self.execute(call, **exec_kwargs)
File "C:\Users\lixx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\git\cmd.py", line 822, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
cmdline: git describe --tags
stderr: 'fatal: not a git repository (or any of the parent directories): .git'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
解决:
下载并解压安装包:https://files.pythonhosted.org/packages/13/09/5ec73a082c7f29a1722a18912987aa35aa611e3fc70197e6c0c331d09fa0/PyMI-1.0.4.zip
修改setup.py文件:version="1.0.4"
报错三:
C:\Users\lixx\Downloads\PyMI-1.0.4>python setup.py install
running install
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\\Lib\\site-packages\\test-easy-install-12848.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.1776.0_x64__qbz5n2kfra8p0\Lib\site-packages\
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.
解决:
把修改过setup.py的PyMI-1.0.4目录,重新制作zip压缩包PyMI-1.0.4.zip,然后
pip install PyMI-1.0.4.zip