0

I am trying to get a virtual environment for Django development but I cannot get it working.

So far I have:

sudo pip3 install virtualenvwrapper

I have then added the following to /home/pi/.bashrc

export WORKON_HOME=$HOME/.virtualenvs

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=' -p /usr/bin/python3 '

export PROJECT_HOME=$HOME/Devel

source /usr/local/bin/virtualenvwrapper.sh

I then reload the startup file:

source ~/.bashrc

And finally I run:

mkvirtualenv my_django_environment

Which outputs the following:

created virtual environment CPython3.7.3.final.0-32 in 460ms creator CPython3Posix(dest=/home/pi/.virtualenvs/my_django_environment, clear=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv) added seed packages: pip==20.2.2, setuptools==49.6.0, wheel==0.35.1 activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator virtualenvwrapper.user_scripts creating /home/pi/.virtualenvs/my_django_environment/usr/local/bin/predeactivate ERROR: Environment '/home/pi/.virtualenvs/my_django_environment' does not contain an activate script.

I'm guessing that this is my problem:

ERROR: Environment '/home/pi/.virtualenvs/my_django_environment' does not contain an activate script.

I've not found any recourse online, only these ERROR: Environment '/home/pi/.virtualenvs/cv' does not contain an activate script & https://stackoverflow.com/questions/60252119/error-environment-users-myuser-virtualenvs-iron-does-not-contain-activation-s/60292344#60292344

Neither of which solve my error. Any ideas?

2 Answers2

1

It is unclear what you are trying to do BUT one thing is clear:-
.bashrc is NOT intended to run scripts.

It is run each time a non-login interactive shell is started and is used to configure the shell.
~/.bashrc: executed by bash(1) for non-login shells.

Milliways
  • 62,573
  • 32
  • 113
  • 225
0

It seems I was missing a line...

And I fixed it by placing the following in /home/pi/.bashrc:

export VIRTUALENVWRAPPER_ENV_BIN_DIR=bin

And then reloading again:

source ~/.bashrc

This then gave me access to commands such as workon etc..

HOWEVER - I have been advised that putting such stuff in .bashrc to get stuff to run at start up is not what .bashrc is for. But I'm new to Linux so I don't know. But what I did, achieved what I was trying to do, rightly or wrongly..