Python and Virtualenv on Windows

后端 未结 5 1463
情深已故
情深已故 2020-12-05 23:40

How do you install virtualenv correctly on windows?

I downloaded virtualenv1.9.1 from here and tried installing it with:

python virtualenv.py install         


        
相关标签:
5条回答
  • 2020-12-06 00:10

    Since I got the same error as mentioned in the question inspite of installing with:

    pip install virtualenv
    

    I would like to add a few points, that might also help someone else solve the error in a similar way as me. Don't know if that's the best way, but for me nothing else helped.

    Install virtualenv

    pip install virtualenv

    Move into Scripts directory

    cd C:\Python27\Scripts
    

    Create a virtual env.

    python virtualenv.exe my_env
    

    Activate the virtual env.

    my_env\Scripts\activate.bat
    

    Deactivate the virtual env.

    my_env\Scripts\deactivate.bat
    
    0 讨论(0)
  • 2020-12-06 00:20

    There is an other way to install Python packages.

    1: download the package, you want
    2: open commander (press the win start-button and search for cmd)
    3: cd into the folder where you downloaded your package
    4: type: "python setup.py install"

    0 讨论(0)
  • 2020-12-06 00:27

    For installing virtualenv, you'll have to either install it using pip as mentioned in the answer by woozyking or you'll have to do something like this:

    $ curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz
    $ tar xvfz virtualenv-1.9.1.tar.gz
    $ cd virtualenv-1.9.1
    $ [sudo] python setup.py install
    

    The command which you have used can be used to create a virtualenv. I would recommend you go through these small videos on virtualenv and virtualenvwrapper to get a better understanding:

    python-power-tools-virtualenv

    virtualenvwrapper

    0 讨论(0)
  • 2020-12-06 00:28
    1. install virtualenv

      pip install virtualenv

    2. create a virtual environment

      python -m virtualenv demoEnv

    3. Activate the environment

      demoEnv\Scripts\activate

    4. To deactivate

      deactivate

    0 讨论(0)
  • 2020-12-06 00:29

    The suggested way to install Python packages is to use pip

    Please follow this documentation to install pip: https://pip.pypa.io/en/latest/installing/

    Note: Python 2.7.9 and above, and Python 3.4 and above include pip already.

    Then install virtualenv:

    pip install virtualenv
    
    0 讨论(0)
提交回复
热议问题