简体   繁体   中英

python setup.py install in anaconda without sudo

I have a local package XYZ that I usually (sucessfully) install using:

sudo python setup.py install

Now instead of a systemwide python installation, I installed Anaconda (for OSX) in my home directory under ~/anaconda3 . Running the above command without sudo , I expected the package to be automatically installed in ~/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. Appreciate any hint on this...

UPDATE:

I tried with sudo . Actually by using sudo the files do get installed in the local path. Only the owner is root. So I had to chwon the files to myself manually. It would be nice to find out why sudo is needed by setup.py at all for installing in my own home folder?

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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