Install Python package from GitHub using PyCharm

前端 未结 5 1774
遥遥无期
遥遥无期 2020-12-05 11:32

I created a VirtualEnv in PyCharm to install my Python packages. I wanted to install this fork of the django project from GitHub.

https://github.com/django-nonrel/dj

相关标签:
5条回答
  • 2020-12-05 11:59

    Please see Gord Thompson's answer for an approach to get this working with Pycharm.

    Here's an alternative of how to get this to work without it:

    Clone the repository:

    git clone https://github.com/django-nonrel/django.git my_folder
    

    The install it manually into your virtualenv:

    cd my_folder
    python setup.py build
    python setup.py install
    
    0 讨论(0)
  • 2020-12-05 12:00

    Alternatively, in console:

    pip install -e git+https://github.com/%%#egg=Package
    
    0 讨论(0)
  • 2020-12-05 12:09

    I was struggling to find a way to do this within the PyCharm UI, but it is possible through the integrated Python console:

    1. Load your project with the appropriate VE
    2. Under the Tools dropdown, click Python Console
    3. Then use pip from within the console:

      import pip
      pip.main(['install','packagename'])
      
    0 讨论(0)
  • 2020-12-05 12:10

    The following worked for me with PyCharm Community Edition 2018.1 on Xubuntu 16.04:

    After loading the project (which was associated with the virtual environment that I wanted to update), I opened PyCharm's Terminal window (AltF12, or View > Tool Windows > Terminal) and then used the command

    pip install git+https://github.com/v-chojas/pyodbc@unicodecolumnsize
    

    to install pyodbc from the "unicodecolumnsize" branch of the fork maintained by user v-chojas.

    Once the install was completed the package showed up in the Project Interpreter widow

    On OSX+PyCharm 2018.1 needed to restart PyCharm to pick up the change and recognize the imports from the newly installed packages.

    If PyCharm does not pick up on the library and places red underlines on your imports, do a File->Invalidate caches/restart and choose invalidate and restart PyCharm.

    0 讨论(0)
  • 2020-12-05 12:10

    I was with the same problem, all i did was : Configure the project interpreter to the Python3 inside the venv/scripts you are using the pip install. Remember to activate the venv. That's it , now you can use the pip install on pycharm or on prompot. The problem is that even with the "venv/lib/sitepackeges" in the your project's sys.path the pycharm looks only for the packages where the project interpreter is

    0 讨论(0)
提交回复
热议问题