Could not install packages due to an EnvironmentError: [Errno 13]

后端 未结 16 636
花落未央
花落未央 2020-12-02 09:50

In my MacOS Mojave terminal I wanted to install a python package with pip. At the end it says:

You are using pip version 10.0.1, however version 18.1 is avai         


        
相关标签:
16条回答
  • 2020-12-02 09:56

    I had the same problem while installing numpy with pip install numpy.

    Then I tried

    sudo -H pip3 install --upgrade pip

    sudo -H pip3 install numpy

    It worked well for me.

    Explanation : The -H (HOME) option with sudo sets the HOME environment variable to the home directory of the target user (root by default). By default, sudo does not modify HOME.

    0 讨论(0)
  • 2020-12-02 09:57

    Regarding the permissions command, try using sudo in front of your terminal command:

    sudo pip install --upgrade pip
    

    Sudo is a program that allows you to run the command with the privileges of the superuser.

    Regarding the python Try running pip as an executable like this:

    python3.6 -m pip install <package>
    
    0 讨论(0)
  • 2020-12-02 09:58

    I was making the same mistakes then I realized that I have created my virtual environment as root user. It was write protected, so please check whether your virtual environment is write protected. make a new venv and try again

    0 讨论(0)
  • 2020-12-02 09:58

    I had similar trouble in a venv on a mounted NTFS partition on linux with all the right permissions. Making sure pip ran with --ignore-installed solved it, i.e.:

    python -m pip install --upgrade --ignore-installed

    0 讨论(0)
  • 2020-12-02 10:00

    The answer is in the error message. In the past you or a process did a sudo pip and that caused some of the directories under /Library/Python/2.7/site-packages/... to have permissions that make it unaccessable to your current user.

    Then you did a pip install whatever which relies on the other thing.

    So to fix it, visit the /Library/Python/2.7/site-packages/... and find the directory with the root or not-your-user permissions and either remove then reinstall those packages, or just force ownership to the user to whom ought to have access.

    0 讨论(0)
  • 2020-12-02 10:04

    On Mac, there is no 3.7 directory or the directory 3.7 is owned by root. So, I removed that directory, create a new directory by current user, and move it there. Then installation finishes without error.

    sudo rm -rf /Library/Python/3.7
    mkdir 3.7
    sudo mv 3.7 /Library/Python
    ll /Library/Python/
    pip3 install numpy
    
    0 讨论(0)
提交回复
热议问题