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. Js 导出Excel IE ActiveX控件

    function ExportExcel() { var oXL = new ActiveXObject("Excel.Application"); //创建excel应用程序对象 ...

  2. 异常处理与调试4 - 零基础入门学习Delphi53

    调试(Debug) 让编程改变世界 Change the world by program 调试(Debug) 在应用程序开发中检测.处理程序中的错误是一个非常重要的环节.在Delphi的集成开发环境 ...

  3. Android Service 通过 BroadcastReceiver 更新Activity UI

    1:MainActivity.java public class MainActivity extends Activity { private TextView tvInfo = null; pri ...

  4. DataTable Select 使用

    DataView dv = new DataView(table); dv.RowFilter = " Type='10' and Visible='true'"; dv.Sort ...

  5. 外贸中MFQ

    MFQ = Mask Fee Quantity 退掩膜费量Masking charge USD 2000. MFQ 100k in the first year

  6. keil TEA

    http://bbs.mydigit.cn/read.php?tid=545086 #include "reg52.h" void send_char(unsigned char ...

  7. 线程初步了解 - <第一篇>

    操作系统通过线程对程序的执行进行管理,当操作系统运行一个程序的时候,首先,操作系统将为这个准备运行的程序分配一个进程,以管理这个程序所需要的各种资源.在这些资源之中,会包含一个称为主线程的线程数据结构 ...

  8. C# 引用类型与值类型在编码上的区别

    一.引入类型与值类型简介 值类型:直接存放于栈中,取的时候是直接取得值.值类型继承自System.ValueType.(自定义对象) 引用类型:存在于托管堆中,取的时候是从栈取该对象的地址,然后用这个 ...

  9. C# 委托2

    委托的定义: (1) 将方法作为变量使用的一种机制,就是将方法当作变量用(声明,赋值,传参)   (2) 将变量当作方法来用,首先就要去声明变量,就要考虑变量的类型,就是(委托变量,对应方法的返回值, ...

  10. redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool

    超时 Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: jav ...