笑故挽风 2009-06-13 14:15 采纳率: 100%
浏览 1095
已采纳

如何离开 / 退出 / 禁用 pythonvirtualenv?

I'm using virtualenv and the virtualenvwrapper. I can switch between virtualenv's just fine using the workon command.

me@mymachine:~$ workon env1
(env1)me@mymachine:~$ workon env2
(env2)me@mymachine:~$ workon env1
(env1)me@mymachine:~$ 

However, how do I exit all virtual machines and workon my real machine again? Right now, the only way I have of getting back to

me@mymachine:~$ 

is to exit the shell and start a new one. That's kind of annoying. Is there a command to workon "nothing", and if so, what is it? If such a command does not exist, how would I go about creating it?

转载于:https://stackoverflow.com/questions/990754/how-to-leave-exit-deactivate-a-python-virtualenv

  • 写回答

8条回答 默认 最新

  • 零零乙 2009-06-13 14:31
    关注

    Usually, activating a virtualenv gives you a shell function named:

    $ deactivate
    

    which puts things back to normal.

    Edit 1

    I have just looked specifically again at the code for virtualenvwrapper, and, yes, it too supports deactivate as the way to escape from all virtualenvs.

    Edit 2

    If you are trying to leave an Anaconda environment, the procedure is a bit different: run the two-word command source deactivate since they implement deactivation using a stand-alone script.

    bash-4.3$ deactivate
    pyenv-virtualenv: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate'
    bash-4.3$ source deactivate
    pyenv-virtualenv: no virtualenv has been activated.
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100