Python 由于“环境错误:[错误 13]:权限被拒绝:'usr/local/bin/f2py'”,无法安装软件包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50807507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"
提问by Sid Mehta
I am trying to install numpy on macOS X but after executing the command pip install numpy
I am getting the error:
我正在尝试在 macOS X 上安装 numpy,但在执行命令后pip install numpy
出现错误:
Environment error :[error 13]: permission denied : 'usr/local/bin/f2py
环境错误:[错误 13]:权限被拒绝:'usr/local/bin/f2py
How do I fix it?
我如何解决它?
回答by SolitaryReaper
回答by Andy
pip install --user package-name
Seems to work, but the package is install the the path of user. such as :
似乎工作,但包是安装用户的路径。如 :
"c:\users\***\appdata\local\temp\pip-req-tracker-_akmzo\42a6c7d627641b148564ff35597ec30fd5543aa1cf6e41118b98d7a3"
“c:\users\***\appdata\local\temp\pip-req-tracker-_akmzo\42a6c7d627641b148564ff35597ec30fd5543aa1cf6e41118b98d7a3”
I want to install the package in python folder such c:\Python27. I install the module into the expected folder by:
我想将软件包安装在 python 文件夹中,例如 c:\Python27。我通过以下方式将模块安装到预期的文件夹中:
pip install package-name --no-cache-dir
回答by shreyans jain
I am also a Windows user. And I have installed Python 3.7 and when I try to install any package it throws the same error that you are getting.
我也是 Windows 用户。我已经安装了 Python 3.7,当我尝试安装任何软件包时,它会抛出与您相同的错误。
Try this out. This worked for me.
试试这个。这对我有用。
python -m pip install numpy
python -m pip install numpy
And whenever you install new package just write python -m pip install <package_name>
每当您安装新软件包时,只需编写 python -m pip install <package_name>
Hope this is helpful.
希望这是有帮助的。
回答by getek mer
I too had to face the same problem. This worked for me. Right click and run as admin than run usual command to install. But first run update command to update the pip
我也不得不面对同样的问题。这对我有用。右键单击并以管理员身份运行,而不是运行通常的命令进行安装。但首先运行 update 命令来更新 pip
python -m pip install --upgrade pip
python -m pip install --upgrade pip
回答by Lucio Mollinedo
I just ran the command with sudo:
我只是用 sudo 运行命令:
sudo pip install numpy
Bear in mind that you will be asked for the user's password. This was tested on macOS High Sierra (10.13)
请记住,系统会要求您提供用户密码。这是在 macOS High Sierra (10.13) 上测试过的
回答by Joabe Lucena
Well, in my case the problem had a different cause, the Windows path Length Check this.
好吧,在我的情况下,问题有一个不同的原因,Windows 路径长度检查这个。
I was installing a library on a virtualenv
which made the path get longer. As the library was installed, it created some files under site-packages
. This made the path exceed Windows limit throwing this error.
我在 a 上安装了一个库,virtualenv
这使得路径变长。安装库后,它在site-packages
. 这使得路径超出了引发此错误的 Windows 限制。
Hope it helps someone =)
希望它可以帮助某人 =)
回答by Mian Asbat Ahmad
I had the same problem for different package. I was installing pyinstaller
in conda on Mac Mojave. I did
我对不同的包有同样的问题。我pyinstaller
在 Mac Mojave 上的 conda中安装。我做了
conda create --name ai37 python=3.7
conda activate ai37
I got the mentioned error when I tried to install pyinstaller using
当我尝试使用安装 pyinstaller 时遇到了提到的错误
pip install pyinstaller
I was able to install the pyinstaller with the following command
我能够使用以下命令安装 pyinstaller
conda install -c conda-forge pyinstaller
回答by user2867432
On Windows this has worked for me. From the command line, specify the path to the exe for Python: & "C:/Program Files (x86)/Python37-32/python.exe" -m pip install --upgrade pip --user
在 Windows 上,这对我有用。从命令行,为 Python 指定 exe 的路径: & "C:/Program Files (x86)/Python37-32/python.exe" -m pip install --upgrade pip --user