简体   繁体   English

我无法在Windows 10命令提示符下安装sklearn,numpy和scipy以在Python 3.6上使用

[英]I cannot install sklearn, numpy, and scipy on Windows 10 command Prompt to use on Python 3.6

I have Python 3.6 correctly installed and have been working on Eclipse. 我已经正确安装了Python 3.6,并且一直在Eclipse上工作。 But I cannot use the libraries. 但是我不能使用这些库。 Every time I import them I get an error message: 每次导入它们时,我都会收到一条错误消息:

Traceback (most recent call last):
  File "C:\Users\gilbe\eclipse-workspace\python3.6\BeginnerFiles\IrisDataSet", line 1, in <module>
    from sklearn import datasets
ModuleNotFoundError: No module named 'sklearn'`

When I tried installing sklearn, numpy, and scipy, I type in the following into Windows Command Prompt: 当我尝试安装sklearn,numpy和scipy时,我在Windows命令提示符中输入以下内容:

"pip install numpy", "pip install scipy", or "pip install sklearn".

However, I get an error message every time. 但是,每次都会收到错误消息。 For example: 例如:

C:\Program Files (x86)\Python36-32\Scripts>pip install sklearn
Collecting sklearn
  Using cached https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz
Collecting scikit-learn (from sklearn)
  Using cached https://files.pythonhosted.org/packages/87/b7/0e7f5c0cf765cf4e1924c068e7b2e1708c93ebffde9302a57ea8f26619e9/scikit_learn-0.19.1-cp36-cp36m-win32.whl
Installing collected packages: scikit-learn, sklearn
Exception:
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python36-32\\Lib\\site-packages\\scikit_learn-0.19.1.dist-info'
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

Further, when I try to upgrade the pip command using the suggested command above, I also get an error message: 此外,当我尝试使用上面建议的命令升级pip命令时,我还会收到错误消息:

C:\Program Files (x86)\Python36-32\Scripts>python -m pip install --upgrade pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
Exception:
Traceback (most recent call last):
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\req\req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "C:\Program Files\Inkscape\python\lib\site-packages\pip\utils\__init__.py", line 267, in renames
    shutil.move(old, new)
  File "C:\Program Files\Inkscape\python\lib\shutil.py", line 303, in move
    os.unlink(src)
WindowsError: [Error 5] Access is denied: 'c:\\program files\\inkscape\\python\\lib\\site-packages\\pip-9.0.1.dist-info\\description.rst'
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

My real question here is how do I fix these issues, and install these libraries correctly, I have spent a whole day trying to fix this in different ways, including: installing the libraries from inside Eclipse, through Window>Preferences>Interpreter>Python Interpreter>Install with pip , Uninstalling and Reinstalling Python, attempting to use the easy_install <package> command. 我真正的问题是如何解决这些问题,并正确安装这些库,我花了一整天的时间来尝试以不同的方式修复此问题,包括:通过 Window> Preferences> Interpreter> Python Interpreter 从Eclipse内部安装这些库。 >使用pip安装,卸载并重新安装Python,尝试使用 easy_install <package>命令。

Please help. 请帮忙。

right click on the windows button on bottom left of your screen. 右键单击屏幕左下方的Windows按钮。 Then go to "Windows PowerShell(Admin). There you try your pip installs. It will definitely work. I think you don't have the admin access that is why you are seeing. 然后转到“ Windows PowerShell(Admin)。在那里尝试安装pip。它肯定会工作。我认为您没有管理员权限,这就是为什么。

PermissionError: [WinError 5] Access is denied

Just open the cmd with admin as user.Hope this helps. 只需以admin用户身份打开cmd,希望这会有所帮助。

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

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