在Catalina,Python / Python3,pip / pip3,PATH,zshrc等中使用zsh时遇到的问题

时间:2019-10-17 01:20:57

标签: python path zsh zshrc macos-catalina

我最近更新了Catalina和默认的zsh。在过渡期间,我可能弄乱了路径,目前,我正在尝试整理Python3.7,pip3,命令行PATH和我的zshrc文件的位置。

似乎/ usr / bin,/ usr / local / bin,/ usr / local / Cellar / python和/Users/[user]/.local/bin中包含潜在的冗余文件

以下是命令的复制品:

$ which python3
/usr/bin/python3
$ which python
/usr/bin/python
$ which pip
pip not found
$ which pip3
/usr/bin/pip3
$ pip3 -V
Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 10, in <module>
    sys.exit(main())
TypeError: 'module' object is not callable
$ cat ~/.zshrc
export PATH=$PATH:/usr/local/bin:/usr/bin
$ echo $PATH
/Users/[user]/.local/bin:/bin:/usr/bin:/usr/local/bin:/Users/[user]/anaconda3/bin:/Users/[user]/anaconda3/bin:/Users/[user]/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/[user]/anaconda3:/Library/TeX/texbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/usr/local/bin:/usr/bin:/usr/local/bin:/usr/bin

有人可以帮我解决所有这些问题吗?据我了解:我只需要Python2.x用于操作系统;使用Catalina,我现在应该将Python3.x 存储在我的用户中(不在/ usr中)吗? pip3是随Python3.x自动安装的(尽管我的返回一个错误),并且还应该安装在我的User中而不是/ usr中?另外,我的$ PATH仍然包含残留物,例如Anaconda,此后我将其删除了...如何/在何处更新我的$ PATH?在zshrc文件中?

6 个答案:

答案 0 :(得分:5)

全新安装Catalina之后,我遇到了这个问题。我也在使用zsh

我做错了什么

我使用以下方法安装了pip的新版本:

sudo pip3 install --upgrade pip

根据提示。但是,这不适用于Apple的python,因为路径不正确。相反,应该使用sudo -H

我如何固定点子:

幸运的是,python3 -m pip仍可作为pip3的解决方法。

安装旧版本的pip(对于我来说,19.3.0就足够了):

sudo -H python3 -m pip install --upgrade pip==19.3.0

然后再次升级:

sudo -H python3 -m pip install --upgrade pip

我希望这也能解决您的问题。

答案 1 :(得分:1)

我和你有同样的问题。解决了

        <a href="#" class="county">Butler County</a>

<div class="row">

    <table class="table">
        <thead>
        <tr class="filters">
            <th>County <!--User-->
            <select id="assigned-county-filter" class="form-control">
                <option>All</option>
                <option>Sedgwick</option>
                <option>Butler</option>
                <option>Harvey</option>
            </select>
            </th>
            <th>City <!--Status-->
            <select id="city-filter" class="form-control">
                <option>Any</option>
                <option>Wichita</option>
                <option>Newton</option>
                <option>Andover</option>
                <option>El Dorado</option>
                <option>Pratt</option>
            </select>
            </th>
            <th>Parking Type <!--Milestone-->
            <select id="type-filter" class="form-control">
                <option>All</option>
                <option>RV Park</option>
                <option>Tiny House Community</option>
            </select>
            </th>
            <th>THA Verified? <!--Priority-->
            <select id="verification-filter" class="form-control">
                <option>All</option>
                <option>Yes</option>
                <option>No</option>
            </select>
            </th>
            <th>Tags
            <select id="tags-filter" class="form-control">
                <option>All</option>
                <option>50+</option>
                <option>Homestead</option>
            </select>
            </th>
        </tr>
        </thead>
    </table>

    <div class="row">
        <div id="task-5" class="task-list-row listing" data-task-id="5" data-assigned-county="Sedgwick" data-city="Wichita" data-type="Tiny House Community" data-verification="Yes" data-tags="None">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <h3 class="listing-title">Bubba's Tiny House Community</h3>
                        <p class="listing-description">
                            2372 Village Road<br>
                            Wichita, Kansas 31162<br>
                            +1.735.421.5435
                        </p>
                    </div>
                    <div class="col-lg">
                        <h3 class="verification">THA Verified</h3>
                    </div>
                </div>
            </div>   
        </div>
    </div> 


    <div class="row">
        <div id="task-4" class="task-list-row listing" data-task-id="4" data-assigned-county="Butler" data-city="El Dorado" data-type="RV Park" data-verification="Yes" data-tags="None">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <h3 class="listing-title">Corner Stone RV Park</h3>
                        <p class="listing-description">
                            2372 Corner Stone Drive<br>
                            El Dorado, Kansas 31162<br>
                            +1.735.421.5435
                        </p>
                    </div>
                    <div class="col-lg">
                        <h3 class="verification">THA Verified</h3>
                    </div>
                </div>
            </div>   
        </div>
    </div> 


    <div class="row">
        <div id="task-3" class="task-list-row listing" data-task-id="3" data-assigned-county="Pratt" data-city="Pratt" data-type="Tiny House Community" data-verification="Yes" data-tags="Homestead">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <h3 class="listing-title">Lakeside Village</h3>
                        <p class="listing-description">
                            2372 Lakeside Drive<br>
                            Pratt, Kansas 31162<br>
                            +1.735.421.5435
                        </p>
                    </div>
                    <div class="col-lg">
                        <h3 class="verification">THA Verified</h3>
                    </div>
                </div>
            </div>   
        </div>
    </div> 


    <div class="row">
        <div id="task-2" class="task-list-row listing" data-task-id="2" data-assigned-county="Harvey" data-city="Newton" data-type="RV Park" data-verification="No" data-tags="50+">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <h3 class="listing-title">Sunset RV Park</h3>
                        <p class="listing-description">
                            2372 Allendale Drive<br>
                            Newton, Kansas 31162<br>
                            +1.735.421.5435
                        </p>
                    </div>
                    <div class="col-lg">
                        <h3 class="verification">Not Verified | Verifiy Now</h3>
                    </div>
                </div>
            </div>   
        </div>
    </div> 

    <div class="row">
        <div id="task-1" class="task-list-row listing" data-task-id="1" data-assigned-county="Butler" data-city="Andover" data-type="RV Park" data-verification="No" data-tags="None">
            <div class="container">
                <div class="row">
                    <div class="col-lg-6">
                        <h3 class="listing-title">Trojan RV Park</h3>
                        <p class="listing-description">
                            2372 1st Drive<br>
                            Andover, Kansas 31162<br>
                            +1.735.421.5435
                        </p>
                    </div>
                    <div class="col-lg">
                        <h3 class="verification">Not Verified | Verify Now</h3>
                    </div>
                </div>
            </div>   
        </div>
    </div> 

</section>

答案 2 :(得分:1)

我通过删除〜/ Library / Python解决了这个问题。

答案 3 :(得分:0)

我也在全新安装的MacOS Catalina上使用Kitty术语emulator + ohmyzsh来解决此问题。

阅读此问题后,我发现我的.zshrc仍然对该行加了注释

\#export PATH=$HOME/bin:/usr/local/bin:$PATH

我删除了注释,将$ HOME / bin添加到PATH

~/.zshrc

export PATH=$HOME/bin:/usr/local/bin:$PATH

此更改使我能够成功运行pip3命令而没有回溯错误。

答案 4 :(得分:0)

我有类似的问题。您可以使用

rehash
在命令行中

更新路径。它为我解决了这个问题。

答案 5 :(得分:0)

该解决方案不适用于我。使用以下命令重新安装python3之后: brew reinstall python3我这样做:

sudo rm -rf /Library/Developer/CommandLineTools xcode-select --install

我从以下网站阅读: https://mikebeach.org/2020/02/08/pip3-crashes-on-macos-catalina/

我希望它对你们有帮助