virtualenv用于创建独立的Python环境,多个Python相互独立,互不影响,它能够在没有权限的情况下安装新套件,不同应用可以使用不同的套件版本,套件升级不影响其他应用。

Virtaulenvwrapper则是virtualenv的扩展包,用于更方便管理虚拟环境,如,新增,删除,复制,切换等。

最近在利用Virtaulenvwrapper的mkvirtualenv创建Python虚拟环境的时候,发现在创建的虚拟环境中升级django为1.8的时候,出现无法升级的状况:(机器外部已经安装django-1.6.10)

shenweiyan@localhost :: ~
=> workon test
(test)shenweiyan@localhost :: ~
=> pip install --upgrade django==1.8
You are using pip version , however version  is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting django==1.8
  Using cached Django-1.8-py2.py3-none-any.whl
Installing collected packages: django
  Found existing installation: Django
    Not uninstalling Django at /usr/local/python2./lib/python2./site-packages, outside environment /App/pyweb/test

Successfully installed django-

提示无法在/usr/local/python2.7/lib/python2.7/site-packages安装django-1.8。其原因就在于在全局环境变量中已经指定了PYTHONPATH,所以在安装django的时候会把1.8的版本默认安装到指定的PYTHONPATH下,从而导致django-1.8无法成功安装。

root@localhost :: ~
=> cat /etc/profile
......
export PATH=/usr/local/python2./bin:$PATH
export PYTHONPATH=/usr/local/python2./lib/python2./site-packages:/usr/lib/python2./site-packages:$PYTHONPATH

所以,把/etc/profile全局变量中的PYTHONPATH注释掉,再重新登录虚拟环境进行安装升级就ok了。

shenweiyan@localhost :: ~
=> workon test
(test)shenweiyan@localhost :: ~
(test)shenweiyan@localhost :: ~
=> pip
You are using pip version , however version  is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting django==
  Using cached Django--py2.py3-none-any.whl
Installing collected packages: django
  Found existing installation: Django
    Uninstalling Django-:
      Successfully uninstalled Django-
Successfully installed django-

ok,问题解决!!!


python虚拟环境Virtualenvwrapper无法升降级虚拟环境软件解决方法的更多相关文章

  1. Python使用easy-install安装时报UnicodeDecodeError的解决方法

    Python使用easy-install安装时报UnicodeDecodeError的解决方法,有需要的朋友可以参考下. 问题描述: 在使用easy-install安装matplotlib.pypar ...

  2. Ubuntu下 fatal error: Python.h: No such file or directory 解决方法

    参考: fatal error: Python.h: No such file or directory Ubuntu下 fatal error: Python.h: No such file or ...

  3. Ubuntu不支持rpm安装软件解决方法

    Ubuntu不支持rpm安装软件解决方法 以前经常使用的是RedHat Linux,习惯使用rpm方法安装软件.最近发现Ubuntu系统居然不支持rpm方法安装软件,提示信息如下: root@root ...

  4. Python使用suds调用webservice报错解决方法:AttributeError: 'Document' object has no attribute 'set'

    使用python的suds包调用webservice服务接口,报错:AttributeError: 'Document' object has no attribute 'set' 调用服务接口代码: ...

  5. python安装途中遇到的问题和解决方法

    一.setuptools安装错误:RuntimeError: Compression requires the (missing) zlib module 1. 描述 搞了个腾讯云的服务器,闲在手上没 ...

  6. Python中pip install MySQL-python报错解决方法

    环境 Centos 7(其他Centos或者RHEL一样) 问题 在执行 pip install MySQL-python 时报错如: Command "python setup.py eg ...

  7. Python: 安装 sklearn 包出现错误的解决方法

    今天在安装 Python 的 sklearn 包时出现了 Cannot uninstall 'numpy' 和 Cannot uninstall 'scipy' 错误,下面记录了我尝试了很多网上的方法 ...

  8. Python使用request包请求网页乱码解决方法

    使用requests请求网页时,返回的页面信息有时是乱码,如下代码 headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) App ...

  9. 如何解决Python下 pip install module 下载慢解决方法?

    对于Python来编程的用户最大的一个痛点就是,下载模块是下载速度特别慢,那么有没有解决方法呢? 换Python的pip下载源 1.首先安装一个模块 pqi,在cmd下 pip install pqi ...

随机推荐

  1. 解决Eclipse编译器报错ClassNotFoundException:Org.hibernate.hql.ast.HqlToken

    最近开发遇到Eclipse编译器老是报出ClassNotFoundException:Org.hibernate.hql.ast.HqlToken [from User Where id=1] 的错误 ...

  2. putty设置

    1- 输入要链接的主机地址 2- 设置connection-->SSH-->Tunnels 点击Add 3- 设置connection 修改为30 4- 点击open,出现ssh登陆,输入 ...

  3. Python之路第十一天,高级(3)-线程池

    线程池 简单的线程池的实现: import queue import threading import time class ThreadPool(object): def __init__(self ...

  4. OC 代理 协议 委托 数据源的概念

    (网摘) OBJC 中的 protocol 相当于 java 里的接口,delagate 就是接口的实现类(C中的回调类似 ): 数据源就是对象遵循了存储数据的协议,可以存储使用数据 协议表示了方法可 ...

  5. 【Xamarin挖墙脚系列:Xamarin.IOS的多个Storybord分隔视图的导航】

    在实际开发中,我是推荐使用画板Storybord的.也可以适当的添加xib进行界面的绘制.尽量不要用或者少用代码绘制视图.(少一些装B分子,可以极大的缩短项目的周期). 不要讲性能,不是不讲性能,ap ...

  6. HDU 1104 Remainder (BFS)

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1104 题意:给你一个n.m.k,有四种操作n+m,n-m,n*m,n%m,问你最少经过多少步,使得最后 ...

  7. Windows下安装使用curl命令

    1 进入http://curl.haxx.se/download/?C=M;O=D网站 2 根据自己的操作系统位数和是否需要SSL下载相应的版本.这里下载curl-7.33.0-win64-ssl-s ...

  8. mac安装GNU命令行工具

    mac安装GNU命令行工具 2.添加的repo     tap home/dupes        brew install coreutils  binutils  diffutils  ed -- ...

  9. Jconsole: JAVA 监视和管理控制台简介

    Jconsole: JAVA 监视和管理控制台简介 JDK中除了提供大量的命令行之外,还提供两个功能强大的可视化工具:JConsole和VisualVM. 之前对java的调试一直停留在 右键-> ...

  10. ubuntu 步步为营之uclinux编译和移植(完整版)

    本节主要包含(ubuntu10.04) 一,linux下的经常使用压缩解压缩命令 二,环境建立 三,内核编译 四,移植 一,linux下的经常使用压缩解压缩命令 在linux下常见的压缩文件格式有ta ...