【发布时间】:2018-07-21 16:27:22
【问题描述】:
注意:人们已将此标记为另一个问题的重复,但事实并非如此。我的 virtualenv 有问题,我无法解决它。这可能与 Visual Studio 的设置方式有关。
我一直跟着这位优秀的tutorial on flask
我在尝试激活 Windows 上的虚拟环境时遇到了问题。你如何执行$ venv\Scripts\activate?这应该来自命令提示符还是 Powershell?我使用 Visual Studio 作为我的 IDE。它为您创建了一个 VS 解决方案,其中包含一个基本的烧瓶应用程序。在创建应用程序的过程中,它会要求您创建一个虚拟环境。它在与教程中显示的目录类似的目录中创建该虚拟环境。 \venv\Scripts 退出,但没有名为“activate”的文件或可执行文件。
这里是 Scripts 文件夹的内容:
api-ms-win-core-console-l1-1-0.dll api-ms-win-core-datetime-l1-1-0.dll
api-ms-win-core-debug-l1-1-0.dll
api-ms-win-core-errorhandling-l1-1-0.dll
api-ms-win-core-file-l1-1-0.dll api-ms-win-core-file-l1-2-0.dll
api-ms-win-core-file-l2-1-0.dll api-ms-win-core-handle-l1-1-0.dll
api-ms-win-core-heap-l1-1-0.dll api-ms-win-core-interlocked-l1-1-0.dll
api-ms-win-core-libraryloader-l1-1-0.dll
api-ms-win-core-localization-l1-2-0.dll
api-ms-win-core-memory-l1-1-0.dll api-ms-win-core-namedpipe-l1-1-0.dll
api-ms-win-core-processenvironment-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-1.dll
api-ms-win-core-profile-l1-1-0.dll
api-ms-win-core-rtlsupport-l1-1-0.dll
api-ms-win-core-string-l1-1-0.dll api-ms-win-core-synch-l1-1-0.dll
api-ms-win-core-synch-l1-2-0.dll api-ms-win-core-sysinfo-l1-1-0.dll
api-ms-win-core-timezone-l1-1-0.dll api-ms-win-core-util-l1-1-0.dll
api-ms-win-crt-conio-l1-1-0.dll api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-filesystem-l1-1-0.dll api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-multibyte-l1-1-0.dll api-ms-win-crt-private-l1-1-0.dll
api-ms-win-crt-process-l1-1-0.dll api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll api-ms-win-crt-utility-l1-1-0.dll
concrt140.dll msvcp140.dll pyexpat.pyd python.exe python3.dll
python36.dll pythoncom36.dll pythonw.exe pywintypes36.dll select.pyd
sqlite3.dll tcl86t.dll tk86t.dll ucrtbase.dll unicodedata.pyd
vccorlib140.dll vcomp140.dll vcruntime140.dll winsound.pyd
xlwings32.dll xlwings64.dll
_asyncio.pyd
_bz2.pyd
_ctypes.pyd
_ctypes_test.pyd
_decimal.pyd
_elementtree.pyd
_hashlib.pyd
_lzma.pyd
_msi.pyd
_multiprocessing.pyd
_overlapped.pyd
_socket.pyd
_sqlite3.pyd
_ssl.pyd
_testbuffer.pyd
_testcapi.pyd
_testconsole.pyd
_testimportmultiple.pyd
_testmultiphase.pyd
_tkinter.pyd
我一直到data migration section,但在这里我需要运行(venv) $ flask db migrate
我不知道如何进入虚拟环境来运行它。
【问题讨论】:
-
文档还解释了如何激活 virtualenv :virtualenv.pypa.io/en/stable/userguide
-
这似乎是由于 Visual Studio 的 Python 工具中的一个错误。只有当您尝试创建 Anaconda 虚拟环境时才会发生这种情况
标签: python windows visual-studio powershell virtualenv