Python不再被识别,无法编码

时间:2018-03-12 01:33:08

标签: node.js angular angular5

所以我为angular5做了一个教程,并且按照指示我首先安装了node / npm,然后在最后我安装了angular cli ghpages,git(win64)并将我的项目上传到github。一切都运作良好。

然后我尝试为角度素材做另一个教程,使用此命令时出错:

npm install @angular/material @angular/cdk --save

以下是它给我的错误日志:

> node-sass@4.8.0 install C:\Users\Thibault\code\ng5-material\node_modules\node-sass
> node scripts/install.js

Cached binary found at C:\Users\Thibault\AppData\Roaming\npm-cache\node-sass\4.8.0\win32-x64-57_binding.node

> node-sass@4.8.0 postinstall C:\Users\Thibault\code\ng5-material\node_modules\node-sass
> node scripts/build.js

Binary found at C:\Users\Thibault\code\ng5-material\node_modules\node-sass\vendor\win32-x64-57\binding.node
Testing binary
Binary has a problem: Error: \\?\C:\Users\Thibault\code\ng5-material\node_modules\node-sass\vendor\win32-x64-57\binding.node is not a valid Win32 application.
\\?\C:\Users\Thibault\code\ng5-material\node_modules\node-sass\vendor\win32-x64-57\binding.node
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at module.exports (C:\Users\Thibault\code\ng5-material\node_modules\node-sass\lib\binding.js:19:10)
    at Object.<anonymous> (C:\Users\Thibault\code\ng5-material\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
Building the binary locally
Building: C:\Program Files\nodejs\node.exe C:\Users\Thibault\code\ng5-material\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@8.10.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Thibault\code\ng5-material\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Thibault\code\ng5-material\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\Thibault\code\ng5-material\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\Thibault\code\ng5-material\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\Thibault\code\ng5-material\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\which\\which.js:13:12)\n    at F (C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\which\\which.js:68:19)\n    at E (C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\which\\which.js:80:29)\n    at C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\which\\which.js:89:16\n    at C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\isexe\\index.js:42:5\n    at C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Program Files\Python36\python.EXE
gyp verb check python version `C:\Program Files\Python36\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.6.2\r\n"
gyp verb could not find "C:\Program Files\Python36\python.EXE". checking python launcher
gyp verb could not find "C:\Program Files\Python36\python.EXE". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Program Files\Python36\python.EXE", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\Thibault\code\ng5-material\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\Thibault\code\ng5-material\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\Thibault\code\ng5-material\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Thibault\\code\\ng5-material\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\Thibault\code\ng5-material\node_modules\node-sass
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.8.0 (node_modules\node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.8.0 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ @angular/cdk@5.2.4
+ @angular/material@5.2.4
updated 2 packages in 11.873s

在视频中它添加了116个软件包,对我来说它只更新了2个,这就是我的选择。 我注意到我得到的一个错误是“错误:找不到:python2”,所以我决定检查我应该拥有的python。

然而,python -v也给了我错误,所以我决定重新安装它。我第一次安装python2但仍然出错,所以我也安装了python3,但没有用。

这是python 2的日志:

C:\Users\Thibault>python -v
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# C:\Python27\lib\site.pyc matches C:\Python27\lib\site.py
import site # precompiled from C:\Python27\lib\site.pyc
# C:\Python27\lib\os.pyc matches C:\Python27\lib\os.py
import os # precompiled from C:\Python27\lib\os.pyc
import errno # builtin
import nt # builtin
# C:\Python27\lib\ntpath.pyc matches C:\Python27\lib\ntpath.py
import ntpath # precompiled from C:\Python27\lib\ntpath.pyc
# C:\Python27\lib\stat.pyc matches C:\Python27\lib\stat.py
import stat # precompiled from C:\Python27\lib\stat.pyc
# C:\Python27\lib\genericpath.pyc matches C:\Python27\lib\genericpath.py
import genericpath # precompiled from C:\Python27\lib\genericpath.pyc
# C:\Python27\lib\warnings.pyc matches C:\Python27\lib\warnings.py
import warnings # precompiled from C:\Python27\lib\warnings.pyc
# C:\Python27\lib\linecache.pyc matches C:\Python27\lib\linecache.py
import linecache # precompiled from C:\Python27\lib\linecache.pyc
# C:\Python27\lib\types.pyc matches C:\Python27\lib\types.py
import types # precompiled from C:\Python27\lib\types.pyc
# C:\Python27\lib\UserDict.pyc matches C:\Python27\lib\UserDict.py
import UserDict # precompiled from C:\Python27\lib\UserDict.pyc
# C:\Python27\lib\_abcoll.pyc matches C:\Python27\lib\_abcoll.py
import _abcoll # precompiled from C:\Python27\lib\_abcoll.pyc
# C:\Python27\lib\abc.pyc matches C:\Python27\lib\abc.py
import abc # precompiled from C:\Python27\lib\abc.pyc
# C:\Python27\lib\_weakrefset.pyc matches C:\Python27\lib\_weakrefset.py
import _weakrefset # precompiled from C:\Python27\lib\_weakrefset.pyc
import _weakref # builtin
# C:\Python27\lib\copy_reg.pyc matches C:\Python27\lib\copy_reg.py
import copy_reg # precompiled from C:\Python27\lib\copy_reg.pyc
# C:\Python27\lib\traceback.pyc matches C:\Python27\lib\traceback.py
import traceback # precompiled from C:\Python27\lib\traceback.pyc
# C:\Python27\lib\sysconfig.pyc matches C:\Python27\lib\sysconfig.py
import sysconfig # precompiled from C:\Python27\lib\sysconfig.pyc
# C:\Python27\lib\re.pyc matches C:\Python27\lib\re.py
import re # precompiled from C:\Python27\lib\re.pyc
# C:\Python27\lib\sre_compile.pyc matches C:\Python27\lib\sre_compile.py
import sre_compile # precompiled from C:\Python27\lib\sre_compile.pyc
import _sre # builtin
# C:\Python27\lib\sre_parse.pyc matches C:\Python27\lib\sre_parse.py
import sre_parse # precompiled from C:\Python27\lib\sre_parse.pyc
# C:\Python27\lib\sre_constants.pyc matches C:\Python27\lib\sre_constants.py
import sre_constants # precompiled from C:\Python27\lib\sre_constants.pyc
import _locale # builtin
# C:\Python27\lib\locale.pyc matches C:\Python27\lib\locale.py
import locale # precompiled from C:\Python27\lib\locale.pyc
import encodings # directory C:\Python27\lib\encodings
# C:\Python27\lib\encodings\__init__.pyc matches C:\Python27\lib\encodings\__init__.py
import encodings # precompiled from C:\Python27\lib\encodings\__init__.pyc
# C:\Python27\lib\codecs.pyc matches C:\Python27\lib\codecs.py
import codecs # precompiled from C:\Python27\lib\codecs.pyc
import _codecs # builtin
# C:\Python27\lib\encodings\aliases.pyc matches C:\Python27\lib\encodings\aliases.py
import encodings.aliases # precompiled from C:\Python27\lib\encodings\aliases.pyc
import operator # builtin
# C:\Python27\lib\functools.pyc matches C:\Python27\lib\functools.py
import functools # precompiled from C:\Python27\lib\functools.pyc
import _functools # builtin
# C:\Python27\lib\encodings\cp1252.pyc matches C:\Python27\lib\encodings\cp1252.py
import encodings.cp1252 # precompiled from C:\Python27\lib\encodings\cp1252.pyc
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

这是python 3的一个:

C:\Users\Thibault>python3 -v
import _frozen_importlib # frozen
import _imp # builtin
import sys # builtin
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'nt' # <class '_frozen_importlib.BuiltinImporter'>
import _thread # previously loaded ('_thread')
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import _weakref # previously loaded ('_weakref')
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import 'winreg' # <class '_frozen_importlib.BuiltinImporter'>
# installing zipimport hook
import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>
# installed zipimport hook
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\__pycache__\__init__.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\__init__.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\encodings\\__pycache__\\__init__.cpython-36.pyc'
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\codecs.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\codecs.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\codecs.cpython-36.pyc'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 0x02F8B950>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\__pycache__\aliases.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\aliases.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\encodings\\__pycache__\\aliases.cpython-36.pyc'
import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0x02F98BB0>
import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0x02F8B2D0>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\__pycache__\utf_8.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\utf_8.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\encodings\\__pycache__\\utf_8.cpython-36.pyc'
import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader object at 0x02FA7A30>
import '_signal' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\__pycache__\latin_1.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\encodings\latin_1.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\encodings\\__pycache__\\latin_1.cpython-36.pyc'
import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader object at 0x02FA7C90>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\io.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\io.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\io.cpython-36.pyc'
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\abc.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\abc.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\abc.cpython-36.pyc'
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\_weakrefset.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\_weakrefset.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\_weakrefset.cpython-36.pyc'
import '_weakrefset' # <_frozen_importlib_external.SourceFileLoader object at 0x02FAF3D0>
import 'abc' # <_frozen_importlib_external.SourceFileLoader object at 0x02FA7EF0>
import 'io' # <_frozen_importlib_external.SourceFileLoader object at 0x02FA7D50>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\site.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\site.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\site.cpython-36.pyc'
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\os.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\os.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\os.cpython-36.pyc'
import 'errno' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\stat.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\stat.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\stat.cpython-36.pyc'
import '_stat' # <class '_frozen_importlib.BuiltinImporter'>
import 'stat' # <_frozen_importlib_external.SourceFileLoader object at 0x02FF7C50>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\ntpath.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\ntpath.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\ntpath.cpython-36.pyc'
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\genericpath.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\genericpath.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\genericpath.cpython-36.pyc'
import 'genericpath' # <_frozen_importlib_external.SourceFileLoader object at 0x02FFCDF0>
import 'ntpath' # <_frozen_importlib_external.SourceFileLoader object at 0x02FF7D70>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\_collections_abc.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\_collections_abc.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\_collections_abc.cpython-36.pyc'
import '_collections_abc' # <_frozen_importlib_external.SourceFileLoader object at 0x030031B0>
import 'os' # <_frozen_importlib_external.SourceFileLoader object at 0x02FB6E70>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\_sitebuiltins.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\_sitebuiltins.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\_sitebuiltins.cpython-36.pyc'
import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader object at 0x02FF2350>
# C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\__pycache__\sysconfig.cpython-36.pyc matches C:\Users\Thibault\AppData\Local\Programs\Python\Python36-32\lib\sysconfig.py
# code object from 'C:\\Users\\Thibault\\AppData\\Local\\Programs\\Python\\Python36-32\\lib\\__pycache__\\sysconfig.cpython-36.pyc'
import 'sysconfig' # <_frozen_importlib_external.SourceFileLoader object at 0x02FF2410>
import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x02FB6370>
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
>>>

所以基本上,我不知道我做错了什么,但没有什么工作正常。我相信我已经超越了我的头脑所以任何帮助都会受到欢迎...... 我只是希望python / node / angular / git按预期工作。对不起,如果答案很明显,我对这一切并不熟悉,我只是按照我找到的教程。

以下是教程btw的链接,以防它可能有用:

原创教程(没有任何问题):https://www.youtube.com/watch?v=oa9cnWTpqP8

第二篇教程(无法安装角度材质):https://www.youtube.com/watch?v=2osMpXOe5fA

0 个答案:

没有答案