bash: mkvirtualenv: command not found

后端 未结 11 1497
天命终不由人
天命终不由人 2020-12-02 06:15

After following the instructions on Doug Hellman\'s virtualenvwrapper post, I still could not fire up a test environment.

[mpenning@tsunami ~]$ mkvirtualenv          


        
11条回答
  •  旧时难觅i
    2020-12-02 06:37

    Prerequisites to execute this command -

    1. pip (recursive acronym of Pip Installs Packages) is a package management system used to install and manage software packages written in Python. Many packages can be found in the Python Package Index (PyPI).

      sudo apt-get install python-pip

    2. Install Virtual Environment. Used to create virtual environment, to install packages and dependencies of multiple projects isolated from each other.

      sudo pip install virtualenv

    3. Install virtual environment wrapper About virtual env wrapper

      sudo pip install virtualenvwrapper

    After Installing prerequisites you need to bring virtual environment wrapper into action to create virtual environment. Following are the steps -

    1. set virtual environment directory in path variable- export WORKON_HOME=(directory you need to save envs)

    2. source /usr/local/bin/virtualenvwrapper.sh -p $WORKON_HOME

    As mentioned by @Mike, source `which virtualenvwrapper.sh` or which virtualenvwrapper.sh can used to locate virtualenvwrapper.sh file.

    It's best to put above two lines in ~/.bashrc to avoid executing the above commands every time you open new shell. That's all you need to create environment using mkvirtualenv

    Points to keep in mind -

    • Under Ubuntu, you may need install virtualenv and virtualenvwrapper as root. Simply prefix the command above with sudo.
    • Depending on the process used to install virtualenv, the path to virtualenvwrapper.sh may vary. Find the appropriate path by running $ find /usr -name virtualenvwrapper.sh. Adjust the line in your .bash_profile or .bashrc script accordingly.

提交回复
热议问题