PYTHON - scrapy startproject command not recognize

2019-06-24 09:13发布

ENVIRONMENT Windows 7 (64) Python 2.7.3 (32) pip install scrapy

I have my paths set C:\Python27;C:\Python27\Scripts

After installing all dependency libs (lxml, openssl, pywin32, twisted, zope) i no longer get errors when I pip install scrapy so everything seems to be installed as needed

PROBLEM:

if i try start from python dir

C:\Python27>  scrapy startproject new
'scrapy' is not recgonized as an internal command or external...

if i try start from scripts dir

C:\Python27\Scripts>  scrapy startproject new
'python' is not recgonized as an internal command or external...

if i try start from folder i want make new scrape

C:\Python27\new>  scrapy startproject new
'scrapy' is not recgonized as an internal command or external...

The path is certainly set right and working properly, otherwise I wouldnt be able to use pip install, virtualenv, etc. Scrapy startproject is only python action I have this problem with

Please help what could stop it from seeing "scrapy startproject" command?

UPDATE:

tried reinstall python273 (32) for "just me" current user, not all users and now have made progress. now i can call scrapy command but ONLY if i explicitly state full path WHILE im in python27 directory. see below

this does not work

C:\> C:\Python27\Scripts\scrapy version
'python' is not recognized as an internal or external command,
operable program or batch file.

this works!

C:\> cd python27

C:\Python27> C:\Python27\Scripts\scrapy version
Scrapy 0.16.3

this does not work

C:\Python27> cd scripts

C:\Python27\Scripts> scrapy version
'python' is not recognized as an internal or external command,
operable program or batch file.

What would cause the need for scrapy to work fine using full path only when in python directory?

finally able to call "scrapy startproject" command, which worked and generated files, but don't think I will ever be able to call "scrapy crawl" command until I get this figured out

标签: python scrapy
2条回答
在下西门庆
2楼-- · 2019-06-24 09:22

rookie mistake - there was after all a problem with my PATH

i saw lot of code examples to set path as set PATH %PATH% .... and thought this PATH was placeholder for scenario. I was typing Python there

FIX - I edited path to include...

for system environment variable:

Variable name: Path 
Variable value: C:\Python27;C:\Python27\Scripts

restarted command prompt and now it all works, scrapy command works as expected and can be called outside main python folder without full directory path to the scrapy file

THANKS Talvalin, I finally found this via your last suggestion to type path and see what it was actually reading

查看更多
够拽才男人
3楼-- · 2019-06-24 09:38

Adding to this solution, make sure that the environment variables have no spaces in them. This just fixed the issue for me.

e.g. C:\Python27;C:\Python27\Scripts NOT C:\Python27; C:\Python27\Scripts

查看更多
登录 后发表回答