简体   繁体   English

python setup.py在没有sudo的anaconda中安装

[英]python setup.py install in anaconda without sudo

I have a local package XYZ that I usually (sucessfully) install using: 我有一个本地软件包XYZ,通常(成功地)使用以下软件包安装:

sudo python setup.py install

Now instead of a systemwide python installation, I installed Anaconda (for OSX) in my home directory under ~/anaconda3 . 现在,我在系统主目录下的~/anaconda3下安装了Anaconda(用于OSX),而不是在系统范围内安装python。 Running the above command without sudo , I expected the package to be automatically installed in ~/anaconda3/lib/python3.6/site-packages 在不使用sudo情况下运行上述命令,我希望该软件包会自动安装在~/anaconda3/lib/python3.6/site-packages

but instead the command results in: 但是该命令导致:

error: [Errno 13] Permission denied: 'XYZ.egg-info/PKG-INFO'

so apparently setup.py install tries to write somewhere where only root has access to. 因此,显然setup.py install尝试在只有root可以访问的地方写东西。 Appreciate any hint on this... 感谢对此的任何提示...

UPDATE: 更新:

I tried with sudo . 我尝试了sudo Actually by using sudo the files do get installed in the local path. 实际上,通过使用sudo将文件安装在本地路径中。 Only the owner is root. 只有所有者是root。 So I had to chwon the files to myself manually. 因此,我不得不手动将文件自己chwon It would be nice to find out why sudo is needed by setup.py at all for installing in my own home folder? 找出为什么为什么setup.py完全需要sudo才能安装在我自己的主文件夹中?

The error is because when you first ran sudo setup.py install , the XYZ.egg_info directory was created (in the same folder as the setup.py file) and was set to be owned by the root user. 错误的原因是,当您第一次运行sudo setup.py install ,已创建XYZ.egg_info目录(与setup.py文件位于同一文件夹中),并将其设置为root用户拥有。 To remove this folder (and any other debris from previous installs) you can run 要删除此文件夹(以及以前安装中的所有其他碎片),可以运行

sudo python setup.py clean --all

or by manually removing them using, eg, sudo rm -r XYZ.egg_info 或使用sudo rm -r XYZ.egg_info手动删除它们

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

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