V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
magicdu
V2EX  ›  Python

pip 和 pip3 同时安装 Django 的问题,建工程怎么指定 Python 版本啊

  •  1
     
  •   magicdu ·
    magicdu · Mar 9, 2017 · 2985 views
    This topic created in 3336 days ago, the information mentioned may be changed or developed.

    Python2.7 用 pip 安装了 Django,Python3.5 用 pip3 安装了 Django ,然后建工程

    django-admin startproject mysite
    
    

    比如我想同时建一个 2.7 的工程和 3.5 的工程。怎么指定 Python 版本啊。

    qweweretrt515
        1
    qweweretrt515  
       Mar 9, 2017
    环境变量
    patrickstar
        2
    patrickstar  
       Mar 9, 2017
    恐怕 pyvenv 或 virtualenv 才是解决之道哦
    shoaly
        3
    shoaly  
       Mar 9, 2017
    virtualenv 应该是一个 prework 了.
    Kilerd
        4
    Kilerd  
       Mar 9, 2017
    建议用 pyenv 来管理多个版本的 python 环境
    siteshen
        5
    siteshen  
       Mar 10, 2017
    看了一下 django-admin 文件的源码, django-admin 文件在 python2 和 python3 下都能跑,所以能这么做:

    python2 $(which django-admin)
    python3 $(which django-admin)

    当然,还是维护多个项目,还是推荐使用 virtualenv 。
    zsz
        6
    zsz  
       Mar 11, 2017 via iPhone
    看一下 https://www.u3v3.com/ar/1256
    点我头像,看简介,可以加群沟通,这样效率比较高
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3732 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 04:29 · PVG 12:29 · LAX 21:29 · JFK 00:29
    ♥ Do have faith in what you're doing.