为了使用Python 3.3和Django 1.8,我在PythonAnywhere上使用Virtualenv(用于Web应用程序)。
我按照以下说明进行操作:https://help.pythonanywhere.com/pages/VirtualEnvForNewerDjango 进入控制台后,显示我正在使用版本3.3。
我按照以下说明进行操作:https://help.pythonanywhere.com/pages/VirtualEnvForNewerDjango 进入控制台后,显示我正在使用版本3.3。
(django18)12:04 ~ $ python
Python 3.3.6 (default, Jan 28 2015, 17:27:09)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
这也是我在我的 Web 应用程序中指定要使用的版本:
Python version:3.3 (in the code pane)
然而,当我在Virtualenv窗格中指向Virtualenv目录(名为django18)时,我会收到以下警告:
This virtualenv seems to have the wrong Python version (2.7 instead of 3.3).
这里是控制台输出的所有内容(我在创建应用并指定 Python 版本后运行了它):
06:43 ~ $ mkvirtualenv --python=/usr/bin/python3.3 django18
Running virtualenv with interpreter /usr/bin/python3.3
Using base prefix '/usr'
New python executable in django18/bin/python3.3
Not overwriting existing python script django18/bin/python (you must use django18/b
in/python3.3)
Installing setuptools, pip, wheel...done.
(django18)06:44 ~ $ which pip
/home/yschellekens/.virtualenvs/django18/bin/pip
(django18)06:44 ~ $ pip install django
Requirement already satisfied (use --upgrade to upgrade): django in ./.virtualenvs/
django18/lib/python3.3/site-packages
(django18)06:44 ~ $ which django-admin.py
/home/yschellekens/.virtualenvs/django18/bin/django-admin.py
(django18)06:44 ~ $ django-admin.py --version
1.8.3
(django18)06:44 ~ $ django-admin.py startproject mysite
CommandError: '/home/yschellekens/mysite' already exists
同时参见:
08:29 ~/.virtualenvs/django18/bin $ ls
__pycache__ django-admin.py pip postdeactivate python3
activate django-admin.pyc pip2 preactivate python3.3
activate.csh easy_install pip2.7 predeactivate wheel
activate.fish easy_install-2.7 pip3 python
activate_this.py easy_install-3.3 pip3.3 python2
django-admin get_env_details postactivate python2.7
08:29 ~/.virtualenvs/django18/bin $
我应该在哪里指向Python 3.3?
django18
的?activate
脚本在哪里?通常它们会被放置在~/.virtualenvs
中,但并不是必须的。 - jonrsharpewhich python
命令时,您看到的路径是什么?