本文介绍了在Windows机器上使用Python 2.7和3.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Windows机器上都有Python 2.7和3.4。我有pip,pip2和pip3。 Pip2是2.7,而其他的是3.4,当运行 pip(,2,3)-V 然而, pip -V pip2 -V pip3 -V 所有显示与点数位置相同的东西,除了pip2显示它是Python3.4。对于所有三个,他们显示的位置是C:\Python27\site-packages。对于pip2来说,这是适用的,但是对于pip3和pip(如果可能,不是100%必需),它们应该将位置显示为C:\Python34。不知道为什么会发生这种情况。但是当我使用pip3安装东西时,最终会出现在C:\Python27\site-packages中,而不是C:\Python34\site-packages \etc.etc。这是一个烦恼,我如何正确设置它,以便我需要的方式?

解决方案

使用--ignore安装了pip,我能够克服这些问题。通过重新创建快捷方式,它现在可以正常工作。似乎有两个版本的python你必须特别小心设置和PYTHONPATH或这些isssue发生。


I have both Python 2.7 and 3.4 on my Windows machine. I have pip, pip2, and pip3. Pip2 is 2.7 while the others are 3.4 when running pip(,2,3) -V However, pip -V, pip2 -V and pip3 -V All show the same thing about pips location and all but pip2 show that it's for Python3.4. For all three the location they show for pip is C:\Python27\site-packages. Which is fine for pip2, but for pip3, and pip(if posssible, not 100% necessary), they should show the location as C:\Python34 instead. Not sure why this happens. But when I install things with pip3, they end up in C:\Python27\site-packages rather than C:\Python34\site-packages\etc.etc. This is an annoyance, how can I set this up correctly so it works the way I need?

解决方案

By using --ignore-installed with pip, I was able to overcome these issues. By recreating shortcuts and such it works fine now. Seems that with two version of python you must take extra care in setup and PYTHONPATH or these isssue occur.

这篇关于在Windows机器上使用Python 2.7和3.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-17 09:37