I added a few aliases to ~/.profile to make creating and activating virtualenvs in python easier. However it doesn’t appear to be reading it as knosole thinks its a typo. I restarted to make sure it could load but stil not activated.
this is all I added.
# Alias for activating virtualenv
alias activate='source .env/bin/activate'
alias virt27='virtualenv -p /usr/bin/python2.7 .env'
alias virt33='virtualenv -p /usr/bin/python3.3 .env'
flebber wrote:
>
> I added a few aliases to ~/.profile to make creating and activating
> virtualenvs in python easier. However it doesn’t appear to be reading it
> as knosole thinks its a typo. I restarted to make sure it could load but
> stil not activated.
>
> this is all I added.
>
> Code:
> --------------------
> # Alias for activating virtualenv
> alias activate=‘source .env/bin/activate’
> alias virt27=‘virtualenv -p /usr/bin/python2.7 .env’
> alias virt33=‘virtualenv -p /usr/bin/python3.3 .env’
>
>
> --------------------
>
>
> How can I get the aliases to activate?
>
>
Have you installed the relevant virtualenv commands/packages
$virtualenv
If 'virtualenv' is not a typo you can use command-not-found to lookup
the package that contains it, like this:
cnf virtualenv
$cnf virtualenv
The program 'virtualenv' can be found in the following package:
* python-virtualenv path: /usr/bin/virtualenv, repository: zypp
(download.opensuse.org-oss_1) ]
Try installing with:
sudo zypper install python-virtualenv
$
sayth@linux-g8u9:~/dev/tproj> sudo zypper in python-virtualenv
root's password:
Loading repository data...
Reading installed packages...
'python-virtualenv' is already installed.
No update candidate for 'python-virtualenv-1.10-2.1.3.noarch'. The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
sayth@linux-g8u9:~/dev/tproj>
Which only proves you have it (well some package) installed. Not that you can use it manualy.
Thus either show how you call it from the console, or at least show
which virtualenv
You allso failed to show what leads you to tell “as knosole thinks its a typo”. You should copy/paste and show us what you see and not tell your conclusions.
Another thing is that in ~/.bashrc I find:
test -s ~/.alias && . ~/.alias || true
which suggest to put extra aliases in a file (to be created) ~/.alias
I do not say that your way of adding aliasses is not correct, but this is what I found.
sayth@linux-g8u9:~> cd testvirt/
sayth@linux-g8u9:~/testvirt> virtualenv -p /usr/bin/python3.3 .env
Running virtualenv with interpreter /usr/bin/python3.3
Using base prefix '/usr'
New python executable in .env/bin/python3.3
Also creating executable in .env/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
sayth@linux-g8u9:~/testvirt> activate
If 'activate' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf activate
sayth@linux-g8u9:~/testvirt>
Have never created an alias file before but will look at it.
It does not work in .profile. Which is confusing. .profile is supposed to be done for every login. Which means that every sub-shell is supposed to have the alias values. But no… To make it more confusing, any environment values set in .profile are kept in sub-shells.
The .bashrc is supposed to be done for every interactive shell. It keeps the alias values.