简体   繁体   English

我在osx上的pip3安装非常混乱,我该如何解决?

[英]my pip3 installation on osx is very confused, how can i fix it?

i have too many installations of python3 in my mac and i can't go on. 我在Mac中安装了太多的python3安装,无法继续。

which python3 gives me: which python3给了我:

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3

but

pip3 -V

gives me: 给我:

pip 18.0 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)

now when i install something with pip it goes on the wrong directory (this happen after i upgraded pip3 i guess) 现在,当我使用pip安装某些东西时,它将进入错误的目录(我猜这是在升级pip3之后发生的)

the problem is that in the past i installed some pip3 packages inside this folder: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages and everytime i run python3 i just can importe those ones. 问题是,过去我在此文件夹中安装了一些pip3软件包: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages ,每次我运行python3时,我都可以导入这些。

how should i fix this confusion? 我该如何解决这种混乱? i guess i need to remove this version of pip3 and reinstall the version compatible with python 3.6 to install packages in the good directory (the old one) but how to do that? 我想我需要删除此版本的pip3,然后重新安装与python 3.6兼容的版本,以便将软件包安装在良好的目录(旧目录)中,但该怎么做?

thanks 谢谢

You need to be running in virtual environments. 您需要在虚拟环境中运行。 One option is to load Anaconda and from Anaconda you can easily set up you virtual environments. 一种选择是加载Anaconda,然后从Anaconda轻松设置虚拟环境。 Anaconda uses conda instead of pip and you won't have the confusion of multiple pips. Anaconda使用conda而不是pip,而不会出现多个pip的困惑。 The command you use to set up a virtual environment is conda create -n yourenvname python=xx anaconda . 用于设置虚拟环境的命令是conda create -n yourenvname python=xx anaconda There are documents showing you how to use Anaconda and how to install and use Virtual Environments . 有一些文档向您显示如何使用Anaconda以及如何安装和使用虚拟环境 This may sound daunting but Anaconda makes this easy. 这听起来让人望而生畏,但Anaconda可以轻松实现。 I have virtual environments for python 2.7.13, 3.65 and 3.7. 我有适用于python 2.7.13、3.65和3.7的虚拟环境。 Its simple to pick the one I want. 选择我想要的一个很简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM