简体   繁体   English

如何删除重复的python路径

[英]how do I delete duplicated python paths

whenever I try to get a module in python, it only works in terminal and I asked someone and they said I had multiple python paths and that terminal was using the correct one.(something like that).每当我尝试在 python 中获取一个模块时,它只能在终端中工作,我问某人,他们说我有多个 python 路径,并且该终端使用的是正确的路径。(类似这样)。 I go into my terminal and find python directory but there are multiple things there and I don't know what to do delete.我进入我的终端并找到 python 目录,但那里有很多东西,我不知道该怎么做删除。 this is what is shown:这是显示的内容:

astroid                 pylint
astroid-2.3.3.dist-info         pylint-2.4.4.dist-info
isort                   six-1.14.0.dist-info
isort-4.3.21.dist-info          six.py
lazy_object_proxy           wrapt
lazy_object_proxy-1.4.3.dist-info   wrapt-1.11.2-py3.8.egg-info
mccabe-0.6.1.dist-info

I have no idea what to uninstall我不知道要卸载什么

MacOS is based on a BSD code base, while Linux is an independent development of a unix-like system. MacOS基于BSD代码库,而Linux是独立开发的类unix系统。 Most of the times, MacOS and Linux has 2 different versions of python(By default MacOS ships with Python-2.7).大多数时候,MacOS 和 Linux 有 2 个不同版本的 python(默认情况下,MacOS 附带 Python-2.7)。 if you want to use python-3 and its modules, you should change somtehing on MacOS.如果你想使用 python-3 及其模块,你应该在 MacOS 上更改 somteh。

if you don't have version 3.x of python, install it with this command:如果您没有 Python 3.x 版,请使用以下命令安装它:

brew install python

and then change the alias of python, in the terminal.然后在终端中更改python的别名。 run:跑:

sudo nano ~/.bashrc

then you can pass in the last line:然后你可以传入最后一行:

    if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
    fi

    alias python='python3.8'
    alias pip= 'pip3'

after all, run:毕竟,运行:

source .bash_profile

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

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