[英]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... 感谢对此的任何提示...
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.