[Fixed]-Get Django Project requirements (pip packages installed) in Pycharm

0πŸ‘

βœ…

I’ve found that this is a common problem, already discussed here.

As you can see from the discussion the values are easily obtained with pip freeze for the virtualenv is giving problems and so I solved this problem with the help of this anwer using the same approach as the First Attempt.

  1. Disabled Django support (Settings -> Languages & Framework -> Django)
  2. Open the Python Console (Tools -> Python Console)
  3. Do:

    from pip.operations import freeze
    x = freeze.freeze()
    for p in x:
        print (p)
    

You may copy the response content to requirements.txt or change the script above to save the requirements directly to a file.

πŸ‘€NBajanca

1πŸ‘

Maybe you don’t have virtualenvwrapper installed? workon is a virtualenvwrapper command, not a virtualenv command. You can either install virtualenvwrapper and use workon or try using virtualenvβ€˜s command like this:

source /path_to_your_virtualenv/bin/activate

If you do have virtualenvwrapper, then you can create a virtual environment using mkvirtualenv -p <your_python> <your_env_name> and use it inside PyCharm going to preferences > Project interpreter.

Leave a comment