How to create virtual env with python3

后端 未结 8 1318
感情败类
感情败类 2020-12-05 06:48

I am using python 2.7 + virtualenv version 1.10.1 for running myproject projects. Due to some other projects requirement I have to work wit

8条回答
  •  既然无缘
    2020-12-05 07:13

    Python already ships with its builtin "virtualenv" called venv since version 3.3. You no longer need to install or download the virtualenv scripts for Python 3.3+.

    https://docs.python.org/3/library/venv.html

    Check that your installation provided the pyvenv command that should take care of creating the "virtualenv". Arguments are similar to the classic virtualenv project.

    $ pyvenv --help
    usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]
                [--upgrade] [--without-pip]
                ENV_DIR [ENV_DIR ...]
    
    Creates virtual Python environments in one or more target directories.
    
    positional arguments:
      ENV_DIR               A directory to create the environment in.
    
    optional arguments:
      -h, --help            show this help message and exit
      --system-site-packages
                            Give the virtual environment access to the system
                            site-packages dir.
      --symlinks            Try to use symlinks rather than copies, when symlinks
                            are not the default for the platform.
      --copies              Try to use copies rather than symlinks, even when
                            symlinks are the default for the platform.
      --clear               Delete the contents of the environment directory if it
                            already exists, before environment creation.
      --upgrade             Upgrade the environment directory to use this version
                            of Python, assuming Python has been upgraded in-place.
      --without-pip         Skips installing or upgrading pip in the virtual
                            environment (pip is bootstrapped by default)
    
    Once an environment has been created, you may wish to activate it, e.g. by
    sourcing an activate script in its bin directory.
    

提交回复
热议问题