问题描述:

I had python 2.6.1 because it was old I decide to install python 3.3.2 but, when I type "python" in my mac it prints it is version 2.6.1 and when I type python3 it shows that this is 3.3.2. I installed django 1.6 but when I check, understand that it is installed for old version of python (python 2.6.1). I want to instal it for my python 3.3.2 what should I do? any way to uninstall python 2.6.1 and when I enter python in terminal it's version be 3.3.2? I have mac os 10.6.8

网友答案:

You could use pip to manage the package for you. If pip is not installed. use

sudo easy_install pip

to install it. Then

pip3 install django

would install django for your python3.

网友答案:

Use python3 to call python version 3 on the command line.

For projects you can use virtual environments:

$ python # this will be version 2
$ python3 -m venv myenv
$ source myenv/bin/activate
$ python # this will be version 3

where myenv will be the folder that hosts the libraries and binaries for that virtual environment. It will automcatically use the python version that was used to initialize this venv - in this case python3. This has the effect that once you activate the venv you can use python there and it will be version 3.

网友答案:

to setup django in pyton3

  1. sudo apt-get install python3-pip
  2. sudo pip3 install virtualenv
  3. virtualenv -p /usr/bin/python3.X venv
  4. source venv/bin/activate

congrats you have setup python3 django and now have many packages to work with

Note: X stands for the version of python

相关阅读:
Top