目录
安装目的及说明
以下操作在win10操作系统中安装虚拟环境,我安装此虚拟环境是为了在windows下用pyinstaller打包可执行程序.EXE,且让其打包出来不再那么大。后续会在文章片尾加上链接地址,以下是安装步骤。
参考文档出处:https://www.jianshu.com/p/21c291f59a94
安装环境
win10操作系统
python 3.7.1
Anaconda3
第一步操作
去直接在你想要创建虚拟环境的路径下我这里是C:\1pipenv,sfift+鼠标右键 打开
power shell 然后输入下面的 代码片
,只需要看命令行,中间的记录请忽略.
PS C:\1pipenv> pip install virtualenv
Requirement already satisfied: virtualenv in d:\pycharmprojects\anaconda3\lib\site-packages (20.0.20)
Requirement already satisfied: distlib<1,>=0.3.0 in d:\pycharmprojects\anaconda3\lib\site-packages (from virtualenv) (0.3.0)
Requirement already satisfied: six<2,>=1.9.0 in d:\pycharmprojects\anaconda3\lib\site-packages (from virtualenv) (1.14.0)
Requirement already satisfied: filelock<4,>=3.0.0 in d:\pycharmprojects\anaconda3\lib\site-packages (from virtualenv) (3.0.12)
Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in d:\pycharmprojects\anaconda3\lib\site-packages (from virtualenv) (1.5.0)
Requirement already satisfied: appdirs<2,>=1.4.3 in d:\pycharmprojects\anaconda3\lib\site-packages (from virtualenv) (1.4.4)
Requirement already satisfied: zipp>=0.5 in d:\pycharmprojects\anaconda3\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv) (2.2.0)
PS C:\1pipenv> virtualenv test
created virtual environment CPython3.7.6.final.0-64 in 7063ms
creator CPython3Windows(dest=C:\1pipenv\test, clear=False, global=False)
seeder FromAppData(download=False, pip=latest, setuptools=latest, wheel=latest, via=copy, app_data_dir=C:\Users\ld\AppData\Local\pypa\virtualenv\seed-app-data\v1.0.1)
activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
PS C:\1pipenv> cd .\test\
PS C:\1pipenv\test> dir
目录: C:\1pipenv\test
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2020/5/16 20:29 Lib
d----- 2020/5/16 20:29 Scripts
-a---- 2020/5/16 20:29 305 pyvenv.cfg
PS C:\1pipenv\test> cd .\Scripts\
PS C:\1pipenv\test\Scripts> dir
目录: C:\1pipenv\test\Scripts
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 2020/5/16 20:29 2292 activate
-a---- 2020/5/16 20:29 1048 activate.bat
-a---- 2020/5/16 20:29 3158 activate.fish
-a---- 2020/5/16 20:29 1815 activate.ps1
-a---- 2020/5/16 20:29 1195 activate.xsh
-a---- 2020/5/16 20:29 1225 activate_this.py
-a---- 2020/5/16 20:29 19208 api-ms-win-core-console-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-datetime-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-debug-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-errorhandling-l1-1-0.dll
-a---- 2020/5/16 20:29 22280 api-ms-win-core-file-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-file-l1-2-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-file-l2-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-handle-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-core-heap-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-interlocked-l1-1-0.dll
-a---- 2020/5/16 20:29 19720 api-ms-win-core-libraryloader-l1-1-0.dll
-a---- 2020/5/16 20:29 21256 api-ms-win-core-localization-l1-2-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-core-memory-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-namedpipe-l1-1-0.dll
-a---- 2020/5/16 20:29 19720 api-ms-win-core-processenvironment-l1-1-0.dll
-a---- 2020/5/16 20:29 20744 api-ms-win-core-processthreads-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-core-processthreads-l1-1-1.dll
-a---- 2020/5/16 20:29 18184 api-ms-win-core-profile-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-core-rtlsupport-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-string-l1-1-0.dll
-a---- 2020/5/16 20:29 20744 api-ms-win-core-synch-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-core-synch-l1-2-0.dll
-a---- 2020/5/16 20:29 19720 api-ms-win-core-sysinfo-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-core-timezone-l1-1-0.dll
-a---- 2020/5/16 20:29 18696 api-ms-win-core-util-l1-1-0.dll
-a---- 2020/5/16 20:29 19720 api-ms-win-crt-conio-l1-1-0.dll
-a---- 2020/5/16 20:29 22792 api-ms-win-crt-convert-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-crt-environment-l1-1-0.dll
-a---- 2020/5/16 20:29 20744 api-ms-win-crt-filesystem-l1-1-0.dll
-a---- 2020/5/16 20:29 19720 api-ms-win-crt-heap-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-crt-locale-l1-1-0.dll
-a---- 2020/5/16 20:29 27912 api-ms-win-crt-math-l1-1-0.dll
-a---- 2020/5/16 20:29 26888 api-ms-win-crt-multibyte-l1-1-0.dll
-a---- 2020/5/16 20:29 71432 api-ms-win-crt-private-l1-1-0.dll
-a---- 2020/5/16 20:29 19720 api-ms-win-crt-process-l1-1-0.dll
-a---- 2020/5/16 20:29 23304 api-ms-win-crt-runtime-l1-1-0.dll
-a---- 2020/5/16 20:29 24840 api-ms-win-crt-stdio-l1-1-0.dll
-a---- 2020/5/16 20:29 24840 api-ms-win-crt-string-l1-1-0.dll
-a---- 2020/5/16 20:29 21256 api-ms-win-crt-time-l1-1-0.dll
-a---- 2020/5/16 20:29 19208 api-ms-win-crt-utility-l1-1-0.dll
-a---- 2020/5/16 20:29 332336 concrt140.dll
-a---- 2020/5/16 20:29 529 deactivate.bat
-a---- 2020/5/16 20:29 106354 easy_install-3.7.exe
-a---- 2020/5/16 20:29 106354 easy_install.exe
-a---- 2020/5/16 20:29 106354 easy_install3.exe
-a---- 2020/5/16 20:29 627440 msvcp140.dll
-a---- 2020/5/16 20:29 30960 msvcp140_1.dll
-a---- 2020/5/16 20:29 205552 msvcp140_2.dll
-a---- 2020/5/16 20:29 106345 pip-3.7.exe
-a---- 2020/5/16 20:29 106345 pip.exe
-a---- 2020/5/16 20:29 106345 pip3.7.exe
-a---- 2020/5/16 20:29 106345 pip3.exe
-a---- 2020/5/16 20:29 25 pydoc.bat
-a---- 2020/5/16 20:29 192000 pyexpat.pyd
-a---- 2020/5/16 20:29 95232 python.exe
-a---- 2020/5/16 20:29 51712 python3.dll
-a---- 2020/5/16 20:29 3750400 python37.dll
-a---- 2020/5/16 20:29 93696 pythonw.exe
-a---- 2020/5/16 20:29 19456 select.pyd
-a---- 2020/5/16 20:29 1705120 tcl86t.dll
-a---- 2020/5/16 20:29 1468064 tk86t.dll
-a---- 2020/5/16 20:29 1016584 ucrtbase.dll
-a---- 2020/5/16 20:29 1065472 unicodedata.pyd
-a---- 2020/5/16 20:29 366320 vccorlib140.dll
-a---- 2020/5/16 20:29 153840 vcomp140.dll
-a---- 2020/5/16 20:29 85232 vcruntime140.dll
-a---- 2020/5/16 20:29 106332 wheel-3.7.exe
-a---- 2020/5/16 20:29 106332 wheel.exe
-a---- 2020/5/16 20:29 106332 wheel3.exe
-a---- 2020/5/16 20:29 21504 winsound.pyd
-a---- 2020/5/16 20:29 307200 xlwings32-0.17.1.dll
-a---- 2020/5/16 20:29 377344 xlwings64-0.17.1.dll
-a---- 2020/5/16 20:29 65536 _asyncio.pyd
-a---- 2020/5/16 20:29 81920 _bz2.pyd
-a---- 2020/5/16 20:29 126976 _ctypes.pyd
-a---- 2020/5/16 20:29 26112 _ctypes_test.pyd
-a---- 2020/5/16 20:29 261632 _decimal.pyd
-a---- 2020/5/16 20:29 201216 _elementtree.pyd
-a---- 2020/5/16 20:29 31744 _hashlib.pyd
-a---- 2020/5/16 20:29 249856 _lzma.pyd
-a---- 2020/5/16 20:29 32256 _msi.pyd
-a---- 2020/5/16 20:29 22016 _multiprocessing.pyd
-a---- 2020/5/16 20:29 37376 _overlapped.pyd
-a---- 2020/5/16 20:29 20480 _queue.pyd
-a---- 2020/5/16 20:29 68608 _socket.pyd
-a---- 2020/5/16 20:29 78848 _sqlite3.pyd
-a---- 2020/5/16 20:29 115712 _ssl.pyd
-a---- 2020/5/16 20:29 45568 _testbuffer.pyd
-a---- 2020/5/16 20:29 92160 _testcapi.pyd
-a---- 2020/5/16 20:29 17408 _testconsole.pyd
-a---- 2020/5/16 20:29 15360 _testimportmultiple.pyd
-a---- 2020/5/16 20:29 24064 _testmultiphase.pyd
-a---- 2020/5/16 20:29 61440 _tkinter.pyd
PS C:\1pipenv\test\Scripts> .\activate.bat
PS C:\1pipenv\test\Scripts> cmd
Microsoft Windows [版本 10.0.17763.1217]
(c) 2018 Microsoft Corporation。保留所有权利。
C:\1pipenv\test\Scripts>start activate.bat
C:\1pipenv\test\Scripts>
第二步操作
输入完上面最后一步: “start activate.bat”之后就会弹出以下的cmd窗口;
前面有虚拟环境的文件夹名(test)即说明创建进入环境成功!!!!
(test) C:\1pipenv\test\Scripts>
(test) C:\1pipenv\test\Scripts>python
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>>