Aim
- Install and use python through virtualenv
Steps
- Install python2 and python3
- Set up python2 workspace
- activate
- do things
- deactivate
- Set up python3 workspace
$ sudo apt-get install python python3 python-dev python3-dev $ sudo apt-get install python-virtualenv $ sudo apt install python-pip $ sudo apt install python3-pip # python 2 environment $ mkdir -p ./python-apps/env_python2 $ cd ./python-apps/env_python2 $ virtualenv . $ source ./app/activate # # Do what you want # $ deactivate # python 3 environment $ mkdir -p ./python-apps/env_python3 $ cd ./python-apps/env_python3 $ virtualenv -p python3 . $ source ./app/activate # # Do what you want # $ deactivate
Python virtualenv windows
# Install python in windows, remember to add python to Path
# open cmd.exe
$ pip install virtualenv
# Go to the working folder
$ virtualenv venv
$ C:\Your working folder\venv\Scripts\activate.bat
# Now you are in the virtualenv
Python autocomplete in spacemacs
- Create virtualenv in any folder
- In spacemacs press SPC-mVa, then select the virtualenv
- DONE
To make this work, you have to make sure the binary python is under <Your selected folder/bin> . If spacemacs cannot find the binary, you will see error message, (file-missing Searching for program No such file or directory python)
沒有留言:
發佈留言