virtualenv在使用anaconda的mac中不起作用

问题描述 投票:0回答:2

我安装了virtualenv,还安装了2个版本的python。一个是通过自制软件,另一个是在anaconda。但是virtualenv并不适用于它们中的任何一个。我发现一些帖子说这是由于凌乱的python版本。但即使我指向不同的python,它仍然无法正常工作。这有什么解决方案吗?谢谢

jzhangMBPr:~ jzhang$ virtualenv -p /Users/jzhang/anaconda/bin/python a
Already using interpreter /Users/jzhang/anaconda/bin/python
Using base prefix '/Users/jzhang/anaconda'
New python executable in /Users/jzhang/a/bin/python
ERROR: The executable /Users/jzhang/a/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/jzhang' (should be '/Users/jzhang/a')
ERROR: virtualenv is not compatible with this system or executable

jzhangMBPr:~ jzhang$ virtualenv  a
Using base prefix '/Users/jzhang/anaconda'
New python executable in /Users/jzhang/a/bin/python
ERROR: The executable /Users/jzhang/a/bin/python is not functioning
ERROR: It thinks sys.prefix is '/Users/jzhang' (should be '/Users/jzhang/a')
ERROR: virtualenv is not compatible with this system or executable
python virtualenv anaconda
2个回答
1
投票

您可能将virtualenv指向错误的Python安装。无论你有哪种python解释器,我都想到了它。 Virtualenv附带一个-p标志,让您具体使用哪个翻译。

使用;

virtualenv -p python test

代替;

virtualenv test

你也可以使用virtualenv -h,它出现了一个帮助文档,用于使用其他特定的virtualenv标志。


0
投票

请检查你的conda init。对我来说跑步:

conda init bash

解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.