Virtualenv说“ root”而不是virtualenv的名称? [英] Virtualenv says "root" instead of the name of virtualenv?

查看:75
本文介绍了Virtualenv说“ root”而不是virtualenv的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在许多Python项目中使用virtualenv。当我尝试激活我的一个virtualenv时,我输入:

For a while, I have been using virtualenv's for many python projects. When I tried to activate one of my virtualenv's, I typed:

source venv/bin/activate

通常可以做到这一点。但是,不是我的命令提示符说:

Which generally does the trick. However, instead of my command prompt saying:

(venv)me@example:~/

它说:

(root)me@example:~/

我的python版本要求和我在virtualenv上安装的软件包都是未能识别。为什么会发生这种情况?

My python version requirement and my packages that I installed on the virtualenv are not recognized. Why does this happen?

推荐答案

尝试:

source activate venv

(而不是 source venv / bin / activate ./ venv / bin / activate.sh 等)

THundtMac$ source activate venv
(venv) THundtMac$ source deactivate
THundtMac$ . ./venv/bin/activate
(root) THundtMac$ source deactivate
THundtMac$

我认为这与使用Anaconda与点子安装版本有关。 (我现在正在使用conda安装的计算机。)

I think this has to do with using Anaconda vs the pip-installed version. (I'm using the conda-installed one now.)

这篇关于Virtualenv说“ root”而不是virtualenv的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆