Running Conda Command-Line Scripts on Windows
I needed to remotely update website content from my Windows machine at home, and while I have Conda installed on Windows, I found I couldn’t directly write and run scripts. I could only launch Conda from the Start menu and type commands line by line.
After some searching and learning, I finally found a solution.
The reason you can’t directly write and run .bat
batch files for Conda commands (which use various Python libraries from Conda) is that the default cmd.exe
doesn’t activate the Conda environment. Once you add the environment activation command, your scripts will run. You can refer to the original English explanation here: https://stackoverflow.com/questions/46305569/how-to-make-batch-files-run-in-anaconda-prompt.
The final command structure looks like this:
call 'G:/conda/Scripts/activate.bat'
scrapy crawl dou
python tupian.py
python post.py
- 原文作者:春江暮客
- 原文链接:https://www.bobobk.com/en/297.html
- 版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议进行许可,非商业转载请注明出处(作者,原文链接),商业转载请联系作者获得授权。