Python Virtual Environments in Windows, virtualenv, lsvirtualenv, venv

sSome commands for Anaconda:
  • Which version do I have?
  • > conda --version
  • The latter actually recommended me to update the conda using conda update -n base conda, so…
  • > conda update -n base conda
  • Creating a new venv: Following, I ran:
  • > conda create -n venv_tf python=3.5
    (venv_tf) > pip install --ignore-installed --upgrade tensorflow
  • Can then simply activate it from ordinary command prompt:
  • > activate venv_tf
    # Deactivate the current venv
    > deactivate
    # Which environments I have?
    > conda env list
    # Get help:
    > conda env
    > conda env --help
  • Can then share your environment’s environment.yml file. See
  • More useful commands from command line: (not necessarily related to Anaconda…)
    • lsvirtualenv to view virtual environments (assuming they were created by venv, and not by conda, because each of these maintains their venvs in different places, I guess).
    • To activate the virtual environment located in C:\Dev\venv\, simply run: C:\Dev\venv\Scripts\activate
    Other notes on PyCharm:
    • PyCharm’s built-in Terminal does NOT work as an external command line. I witnessed different error messages (formatted differently, less detailed) in the built-in Terminal. In one case, python did NOT work from the built-in Terminal, while the same command worked from a normal command line.
    • If the packages you install need for some reason Visual Studio C++ of some version, it did NOT help me to add to the PATH the directories where my Visual Studio C++ was located (namely, set PATH=C:\Users\%USERNAME%\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64;C:\Users\%USERNAME%\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin\x64;C:\Users\%USERNAME%\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\WinSDK\Bin;%PATH%). Instead, press “Start”, then search for “Visual C++ Command Prompt” or something like that, and this command prompt already includes in its %PATH% variable the relevant directories.
    Other notes on python:
    • — Unofficial Windows Binaries for Python Extension Packages

    Leave a Reply

    Your email address will not be published. Required fields are marked *