[英]permission denied when installing python packages through cygwin
I'm working on a windows 7 and using Cygwin for unix-like functionality. 我正在Windows 7上使用Cygwin来实现类似Unix的功能。 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
. 我可以从Cygwin控制台正常编写和运行Python脚本,并且使用pip install
成功安装了Python软件包,并且已安装的软件包出现在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'". 但是,如果我尝试运行导入这些程序包的脚本,例如“ aloe”程序包,则会出现错误“没有这样的名为“ 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. 我发现这些软件包正在安装到c:\\ python27 \\ lib \\ site-packages,即计算机的python软件包的常规列表,而不是/usr/lib/python3.6/site-packages,即Cygwin中可用的python软件包。 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 如果我尝试使用easy_install-3.6 aloe
指定安装位置, easy_install-3.6 aloe
收到错误消息
[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'. 无奈之下还尝试使用cmd和cp -r \\python27\\lib\\site-packages\\aloe \\cygwin\\lib\\python3.6\\site-packages
直接将'aloe'目录复制到Cygwin Python软件包目录中,并且移动成功,但问题仍然存在,当我使用ls /usr/lib/python3.6/site-packages
Cygwin控制台时,看不到“ 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. 我通常对计算机具有管理员权限(无论如何,Cygwin中均不提供sudo
),因此真的无法弄清楚问题出在哪里。 Any help would be greatly appreciated. 任何帮助将不胜感激。
Thanks. 谢谢。
just make sure you are in admin mode. 只要确保您处于管理员模式即可。
ie right click on Cygwin, select running as administrator
. 即,右键单击Cygwin,选择running as administrator
。
then install your package specifically using pip3, for python3. 然后使用pip3专门为python3安装软件包。
ie pip3 install your_package
即pip3 install your_package
with updated version, do pip3 install --upgrade your_package
使用更新的版本,请执行pip3 install --upgrade your_package
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.