I have a VPS running Centos6, which has Python2.6 pre-installed. I have installed Python3.6 on this path
/usr/local/bin/python3.6
I have installed virtualenv using pip which is at
/usr/local/bin/virtualenv
I then created a virtualenvwrapper.sh file under /etc/profile.d (I have been advised this is what I need to do) which is generating an error on start up:
/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.
virtualenvwrapper is located at /usr/local/bin/python3.6/site-packages
As I am novice using Linux I didn't think the code in the file virtualenvwrapper.sh (under /etc/profile.d)
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
UPDATE
I have now edited the virtualenvwrapper.sh file under /etc/profile.d as follows
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.6
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
This has worked fine - I can now run the virtualenvwrapper commands. Is it pk that all of the start up files have been placed in the .virtualenvs folder (eg initalize, postactivate etc) - which means that when I create a virtualenvironment, that will be placed alongside these files? Is there a better way to do this?
Many thanks
Answering your second question: this is how virtualenvwrapper
works. It puts global initialization files into ~/.virtualenvs
; these files will be run (sourced, actually) for every virtual env. Also there will be separate initialization files for every virtual env.
Having all virtual envs in ~/.virtualenvs
helps virtualenvwrapper
to manage all envs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.