问题描述
我正在尝试使用 virtualenvwrapper
创建一个 virtualenv,但是当我使用 mkvirtualenv
时,我得到以下信息:
I'm trying to create a virtualenv with virtualenvwrapper
, but when I use mkvirtualenv
I get the following :
ERROR: virtualenvwrapper could not find virtualenv in your path
我认为这是一个 PYTHONPATH 问题.但是如果我做一个 pip show virtualenv
我得到以下内容:
I assumed it was a PYTHONPATH problem.But if I do a pip show virtualenv
I get the following :
---
Metadata-Version: 2.0
Name: virtualenv
Version: 13.1.0
Summary: Virtual Python Environment builder
Home-page: https://virtualenv.pypa.io/
Author: Jannis Leidel, Carl Meyer and Brian Rosner
Author-email: python-virtualenv@groups.google.com
License: MIT
Location: /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages
Requires:
这是我的PYTHONPATH:
/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/bin:/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/bin:/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages:/Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/库/Python/2.7/lib/python/site-packages:~/.brew/Cellar
它包含包含 virtualenv 的目录!
It contains the directory containing virtualenv!
(即:/Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages)
我的~/.zshrc 包含:
export WORKON_HOME=~/Envs
export PROJECT_HOME=$HOME/Devel
source $HOME"/Library/Python/2.7/bin/virtualenvwrapper.sh"
virtualenvwrapper.sh 是用 bash 编写的,也许我应该检查我的 PATH 而不是我的 PYTHONPATH ?
EDIT :virtualenvwrapper.sh is written in bash, perhaps should I check my PATH instead of my PYTHONPATH ?
那么,可能是什么问题?我该如何解决?
So, what could the problem be? How could I fix it?
预先感谢您的帮助.
推荐答案
我终于找到了问题所在:
I finally found out what the problem was :
virtualenvwrapper.sh 是用 BASH 编写的,而不是用 Python 编写的.所以 virtualenv 是从 shell (zsh) 调用的.我不必担心我的 PYTHONPATH,而是我的 PATH(无论如何,我已经能够从我的 python shell 中导入 virtualenv).
virtualenvwrapper.sh is written in BASH and not in Python.So virtualenv is called from a shell (zsh).I didn't have to bother about my PYTHONPATH, but about my PATH (I was already able to import virtualenv from my python shell anyway).
我刚刚将正确的目录添加到我的 PATH 并且一切正常(包含 virtualenv
可执行文件的目录,即 /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages
尽管是目录 PATH
,但它默认不包含在我的 PATH
中code>virtualenv 和其他 pip 安装的工具在).
I just added the correct directory to my PATH and everything worked fine (the directory containing the virtualenv
executable, i-e /Volumes/Data/nfs/zfs-student-3/users/2013_paris/vmonteco/Library/Python/2.7/lib/python/site-packages
which isn't included in my PATH
by default despite being the directory virtualenv
and other pip-installed tools was in).
这篇关于错误:virtualenvwrapper 在您的路径中找不到 virtualenv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!