0

I have created a project in pycharm in windows. Now I want to move it to linux machine and I want to use same virtualenv (likely complete venv folder) which I created using pycharm.

After moving venv folder, and running source activate, I am getting below error:

bash: $'\r': command not found
bash: activate: line 4: syntax error near unexpected token `$'{\r''
'ash: activate: line 4: `deactivate () {

In the activate.sh file, it's commented as:

  1 # This file must be used with "source bin/activate" *from bash*
  2 # you cannot run it directly

but where is bin directory? Do I need to create manually? I even copied the activate file to /bin folder but didn't work. (I might be wrong here).

Also I tried after updating VIRTUAL_ENV in activate file, but not luck.

 40 #VIRTUAL_ENV="C:\Users\essen\django_works\myproj\venv"
 41 VIRTUAL_ENV="${pwd}"

Please help me out. Thanks!

Dr. Essen
  • 603
  • 2
  • 9
  • 25
  • Looks the files generated under Windows have carriage return at line end. Use a dos2unix utility to clean up – Bing Wang Apr 10 '21 at 11:08
  • Virtual environments are strictly local anyway; you can't copy over the files and expect it to work. Just create a new virtualenv and populate it with the same dependencies. A common arrangement is to document them in `requirements.txt` so that this is literally a two-liner. – tripleee Apr 10 '21 at 11:11
  • Thanks @tripleee, currently I followed the same. – Dr. Essen Apr 10 '21 at 11:17
  • @BingWang, ah!! this might be the reason for those. I will check that. Thanks! – Dr. Essen Apr 10 '21 at 11:18

0 Answers0