I have hit a bit of a brick wall regarding the set up of django 1.7 using a virtualenv configured to Python 3.4.
I have created a Python 3.4 virtualenv using:
sudo virtualenv --no-site-packages -p /usr/bin/python3.4 venv
I have then activated the env using:
source venv/bin/activate
Once in the activated virtualenv i have tried:
sudo pip install https://www.djangoproject.com/download/1.7b1/tarball/
This installs django in the Python 2.7 directory and not in the virtual environment..
Checking with pip freeze
shows no installed packages
I have tried downloading the zip for django 1.7 and using python setup.py install
within the environment but still get the install occurring outside of the env and in the 2.7 directory..
Any advice or pointers on what i'm doing wrong would be really appreciated!!
How To Install Python Django In Virtual Environment. 1 1. Install Python virtualenv Module. 2 2. Create A Virtual Environment And Activate It. 3 3. Install Django In Virtual Environment. 4 4. Create Django Project. 5 5. Create SQLite Database. More items
If you're working with Python 3, you should install virtualenv using pip3. These instructions assume you've already installed a custom version of Python 3. After it's installed and your shell is using this version, run pip3 to install virtualenv: [server]$ pip3 install virtualenv.
Using virtualenv to install Django is recommended on DreamHost Shared and Private servers since your user doesn't have access to install into shared directories. When you use virtualenv, you create an isolated environment with its own installation directories which your user has full permissions to.
When working with virtual environments in Python, it's common to use a custom version of Python rather than the server's version. To create a new virtual environment using your custom installed version of Python, follow these steps: The following steps use Python version 3.6.2.
sudo
is unnecessary when creating a virtualenv and when installing with pip inside a virtualenv. Try the following instead:
$ virtualenv -p /usr/bin/python3.4 venv
$ source venv/bin/activate
(At this point, you can check that your virtualenv is active and using python 3.4 with which python
, which should print something like /home/user/projects/venv/bin/python
, and python --version
, which should print Python 3.4.x)
$ pip install https://www.djangoproject.com/download/1.7b1/tarball/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With