简体   繁体   English

设置Virtualenv和Virtualenvwrapper的问题

[英]Issues setting up Virtualenv and Virtualenvwrapper

I'm trying to install virtualenv and virtualenvwrapper so that I can do some django work. 我正在尝试安装virtualenvvirtualenvwrapper以便我可以做一些django工作。

I'm not exactly sure where the issue is stemming from. 我不确定问题的根源。 I currently have installed Jupyter Notebook and installed a lot of python files though it (python 3+ I believe), so when I did pip install virtualevnwrapper , the location of the shell file was in C:/Users/'Andy Renz'/Anaconda3/Scripts/virtualenvwrapper.sh . 我目前已经安装了Jupyter Notebook并安装了许多python文件(我相信是python 3+),所以当我pip install virtualevnwrapper ,外壳文件的位置在C:/Users/'Andy Renz'/Anaconda3/Scripts/virtualenvwrapper.sh I account for this in changing by .bashrc file, by including: 我通过更改.bashrc文件来解决此问题,包括:

export WORKON_HOME=$HOME/.virtualenvs
source C:/Users/'Andy Renz'/Anaconda3/Scripts/virtualenvwrapper.sh

When I run source ~/.bashrc in my shell, I get the following: 当我在外壳中运行source ~/.bashrc时,得到以下信息:

bash: /usr/bin/python: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could no import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for 
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and the PATH is
set properly.

I think this means python isn't where it is supposed to be. 我认为这意味着python不在应有的位置。 Virtualenv references python 2+ I believe which leads me to believe my python 2 is somewhere odd. 我相信Virtualenv引用python 2+,这使我相信我的python 2很奇怪。 I do have it, not downloaded from Jupyter. 我有它,不是从Jupyter下载的。 How do I account for this and proceed forward? 我该如何处理并继续前进?

The issue is you're trying to install the default virtualenvwrapper (for Linux) on a Windows machine. 问题是您正在尝试在Windows计算机上安装默认的virtualenvwrapper(对于Linux)。 That's why it's trying to get Python from /usr/bin/python, a directory that does not exist in Windows. 这就是为什么它试图从/ usr / bin / python(Windows中不存在的目录)中获取Python的原因。

Try virtualenvwrapper-win from https://pypi.python.org/pypi/virtualenvwrapper-win https://pypi.python.org/pypi/virtualenvwrapper-win尝试virtualenvwrapper-win

Python is somehow either not installed or installed at different path maybe /usr/local/bin . 某种程度上未安装Python或将其安装在/usr/local/bin不同路径中。 Use which python or whereis python to check if python is indeed installed and path of installation. 使用which pythonwhereis python检查是否确实安装了python以及安装路径。 Then you can create a softlink to the python executable in your /usr/bin directory. 然后,您可以在/ usr / bin目录中创建到python可执行文件的软链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM