I just create a new project in PyCharm, then try to run the command scrapy startproject filename. Then the error happened.
Traceback (most recent call last):
File "c:\users\管理员\appdata\local\programs\python\python38\lib\runpy.py", line 194, in
_run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\管理员\appdata\local\programs\python\python38\lib\runpy.py", line 87, in
_run_code
exec(code, run_globals)
File "C:\Users\administrator\AppData\Local\Programs\Python\Python38\Scripts\scrapy.exe\__m
ain__.py", line 4, in <module>
ModuleNotFoundError: No module named 'scrapy'
Before I created this project, I had found that the administrator name was in Simple Chinese. To avoid the further problem in other project, I modify the name from simply Chinese as well and the file name in C://users/管理员
(where I installed the Python) and in the Path in system environment variables.
Does this error happen because of modification of the name? Or is there any other default configuration in PyCharm I need to modify?
After searching from a website named CSDN, I found this method works for my problem. I just briefly describe how I handle that.Hope it will be helpful for other people who meet the similar problem. The link: https://blog.csdn.net/weixin_39278265/article/details/82938270
I installed the scrapy under C://user/管理员/.../Python38/... And yesterday after I installed scrapy, I found it doesn't work in Pycharm but, in MS-DOS, it worked. Some people told me the path with UTF-8 characters caused the problem. So I modified the path from UTF-8 characters to English characters.
Then I deleted all the path environmental variables of Python in System and modified the path environmental variables of Python in Users from UTF-8 characters to English Characters.
After that I opened the pip.exe, pip3.exe, scrapy.exe in...python38/scripts/ by Notepad and modified the path in the same way I did above.
After that I opened the PyCharm then run the command scrapy startproject projectname,it worked as in CMD interface and showed:
You can start your first spider with: cd sxh01 scrapy genspider example example.com
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.