如何使用PIP与蟒蛇的多个实例 [英] How to use pip with multiple instances of python

查看:155
本文介绍了如何使用PIP与蟒蛇的多个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近安装python3才知道原来的mysql-蟒蛇以及许多其他模块并没有得到很好用它支持呢。所以我改变了路径在我的.bashrc文件指向的Python 2.7的安装。问题是,当我安装Python 3中我也装分发和与它一起点子。我删除了PIP和/分发使用Python 2.7然而现在从python3 bin目录中的文件和安装setuptools的画中画,当我使用PIP命令来安装Django和mysql-蟒蛇,我得到一个bash错误python331 / bin中PIP没有这样的文件或目录。它仍然在寻找在python3安装点子。我怎样才能解决这个问题?

感谢


解决方案

  

...我得到一个bash误差 python331 /斌/ PIP没有这样的文件或目录
  它仍然在寻找在python3安装点子。我怎么能补救
  此?


庆典,默认情况下,散列命令的位置,以避免搜索 $ PATH 每一次,所以如果,当你执行...

  $类型点子

...你喜欢的东西...

  PIP被散列(python331 /斌/ PIP)

...你只需要清除哈希表庆典与...

  $哈希-r

...那么它会在Python 2.7您尝试运行 PIP下一次拿起版本

I recently installed python3 only to realize that mysql-python as well as many other modules were not well supported with it yet. So I changed the path in my bashrc file to point to an installation of python 2.7. The problem is that when I installed python 3 I also installed distribute and pip along with it. I removed the pip and distribute files from the python3 bin directory and installed setuptools and pip using python 2.7 however now when I use the pip command to install django and mysql-python, I get a bash error python331/bin/pip No such file or directory. It's still looking for pip in the python3 install. How can I remedy this?

Thanks

解决方案

...I get a bash error python331/bin/pip No such file or directory. It's still looking for pip in the python3 install. How can I remedy this?

bash, by default, hashes the locations of commands to avoid searching $PATH each time, so if, when you execute...

$ type pip

...you get something like...

pip is hashed (python331/bin/pip)

...you just need to clear the hash table for bash with...

$ hash -r

...then it'll pick up the version in Python 2.7 the next time you try to run pip.

这篇关于如何使用PIP与蟒蛇的多个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆