简体   繁体   中英

permission denied when installing python packages through cygwin

I'm working on a windows 7 and using Cygwin for unix-like functionality. I can write and run Python scripts fine from the Cygwin console, and the installation of Python packages using pip install is successful and the installed package appears under pip list . However, if I try to run a script that imports these packages, for example the 'aloe' package, I get the error "no such module named 'aloe'".

I have discovered that the packages are being installed to c:\\python27\\lib\\site-packages, ie the computer's general list of python packages, and not to /usr/lib/python3.6/site-packages, ie the list of python packages available within Cygwin. I don't know how to rectify this though. If I try to specify the install location using easy_install-3.6 aloe I get the error

[Errno 13] Permission denied: '/usr/lib/python3.6/site-packages/test-easy-install-7592.write-test'.

In desperation also tried directly copying the 'aloe' directory to the Cygwin Python packages directory using cmd with cp -r \\python27\\lib\\site-packages\\aloe \\cygwin\\lib\\python3.6\\site-packages and the move was successful, but the problem persists and when I check in the Cygwin console using ls /usr/lib/python3.6/site-packages I can't see 'aloe'.

I have admin rights to the computer in general ( sudo is not available in Cygwin anyway) so really can't figure out what the problem is. Any help would be greatly appreciated.

Thanks.

just make sure you are in admin mode.

ie right click on Cygwin, select running as administrator .

then install your package specifically using pip3, for python3.

ie pip3 install your_package

with updated version, do pip3 install --upgrade your_package

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