Python setup : command not found

耗尽温柔 提交于 2019-12-18 06:13:41

问题


Apologies if this is a basic question:

I have been trying to setup Python on my laptop by following the tutorial here. Under PIP, VIRTUALENV + VIRTUALENVWRAPPER subtitle, it says

  1. And now setup virtualenvwrapper:

    1 $ export WORKON_HOME=$HOME/.virtualenvs
    
    2 $ export MSYS_HOME=/c/msys/1.0
    
    3 $ source /usr/local/bin/virtualenvwrapper.sh
    

The last line of above gives me the following error:

$ source /usr/local/bin/virtualenvwrapper.sh
sh.exe": /usr/local/bin/virtualenvwrapper.sh: No such file or directory

So when I test my setup I get the following error:

$ mkvirtualenv TestEnv
sh.exe": mkvirtualenv: command not found

Could some1 help me out please?

THis is all on a Win7 laptop.

Thanks.


回答1:


From what you wrote it looks to me that you are mixing Windows and Linux shell commands.

I strongly advocate you get the virtualenv working first before you turn to a wrapper

To get virtualenv on Windows 7

pip install virtualenv

then

virtualenv name_to_your_env

name_to_your_env\Scripts\activate



回答2:


I was having this same problem but got it to work a different way in Windows.

pip install virtualenv
virtualenv venv

.\venv\Scripts\activate.bat

The key here is running activate.bat rather than just activate. Once I did this and closed and opened cmd again and tried the normal

.\venv\Scripts\activate

it worked. I don't know why but it worked for me, hopefully it helps somebody else.




回答3:


According to your comment, virtualenvwrapper.sh is not in /usr/local/bin.

You should pass correct path to source command.

source /path/to/..../Scripts/virtualenvwrapper.sh



回答4:


I had encountered with the same problem and solved it by downloading mktemp binary for windows and uncompressing it under git/bin. Then it works. (I was trying to run leiningen [lein help] command under Git Bash, on Windows 7)

This is the download site i visited.



来源:https://stackoverflow.com/questions/18684231/python-setup-command-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!