zoukankan      html  css  js  c++  java
  • virtualenv virtualenvwrapper 虚拟环境创建

    virtualenv  方式

    安装

        C:UsersPython> pip install virtualenv
        Requirement already satisfied: virtualenv in c:python36libsite-packages (16.4.1)
    
        C:UsersPython>

    创建

    首先创建一个空文件夹

    [~]$ mkdir  yangtuo
    [~]$ cd yangtuo/
    [~/yangtuo]$ 

    创建 虚拟环境

    [~/yangtuo]$ virtualenv --no-site-packages yangtuotest
      No LICENSE.txt / LICENSE found in source
    New python executable in /data/home/v_vtongyang/yangtuo/yangtuotest/bin/python
    Installing setuptools, pip, wheel...
    done.
    [~/yangtuo]$ 

    切换

    [~/yangtuo]$ source yangtuotest/bin/activate
    (yangtuotest) [~/yangtuo]$

    退出

    (yangtuotest) [~/yangtuo]$ deactivate 
    [~/yangtuo]$ 

    virtualenvwrapper  方式

    安装

    创建虚拟环境需要用到另一个 virtualenvwrapper 如果是 windows 环境下要加 -win

        (testvir) C:UsersPython	estvirScripts>pip install virtualenvwrapper-win
        ...

    创建虚拟环境并进入

        (testvir) C:UsersPython	estvirScripts>mkvirtualenv testvir2
         C:UsersPythonEnvs is not a directory, creating
        Using base prefix 'c:\python36'
        New python executable in C:UsersPythonEnvs	estvir2Scriptspython.exe
        Installing setuptools, pip, wheel...
        done.
    
        (testvir2) C:UsersPython	estvirScripts>

    查看当前虚拟环境

        C:UsersPython	estvirScripts>workon
    
        Pass a name to activate one of the following virtualenvs:
        ==============================================================================
        testvir2
    
        C:UsersPython	estvirScripts>

    退出虚拟环境

    (testvir2) C:UsersPython	estvirScripts>deactivate.bat

    进入虚拟环境

        C:UsersPython	estvirScripts>workon testvir2
        (testvir2) C:UsersPython	estvirScripts>

    pychram  使用虚拟环境

     如果已有的直接使用即可

    没有的哈则需要自己添加 

     可以在 pycharm 里面查看下当前环境下的 组件情况以确认是否成功

  • 相关阅读:
    Vue常见问题总结
    vue学习记录
    内卷
    at least once 和 at most once 问题
    IO学习笔记(全)
    IO学习笔记7
    IO学习笔记6
    IO学习笔记5
    IO学习笔记4
    IO学习笔记3
  • 原文地址:https://www.cnblogs.com/shijieli/p/10524818.html
Copyright © 2011-2022 走看看