How to import modified library instead of previously installed one? [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am new to GitHub and as in the title I am asking for help.
I originally installed the library using pip install. Then I have to make some changes in the code and forked it and downloaded it local. I have made my changes and I am trying to import the modified code in python. I have tried to push it on GitHub but I couldn't find a way to import it from there.
Thank you for your time

import <module>
And use the module in python.

You should do the following in the terminal:
cd package_dir
pip install .
This will replace the original and install the modified package.
Now you can import your modified package in python
Additionally, if you intend to keep developing the package, you could check this out: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode

Related

How to download beautifulsoup [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 months ago.
Improve this question
I am taking an info storage and retrieval class, and to complete an assignment we need to download and use the beautifulsoup package for python. I haven't used Python in years, so I'm very rusty and cannot seem to figure out how to download a Python package. I'm using Python 3 and have Windows 10.
you can use pip install beautifulsoup4
Make sure that you have the Python executable in your environment variable Path.

Using shodan from the terminal [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I've been looking forward to downloading the command-line interface for "Shodan".
On the website they say that i basically have to type "pip install -U --user shodan" in my cmd, so i did multiple times and it now says that the requirement are already satisfied, which feels normal since i did it multiple times trying to fix said problem.
Now the problem is, next step is to basically type "shodan" in the cmd, problem is it says 'shodan' isn't recognized.
What am i supposed to do ! :(
You need to add the path of the scripts to your system PATH variable:
It is something like this:
C:\Python38\Scripts
When you run pip install, it installs an exe file under the Scripts folder of your python installation. You should add this path to the PATH variable as described in the link. This makes the exe available in the terminal.
See this guide for more information:
https://datatofish.com/add-python-to-windows-path/

Is sys.path.append() a good workaround? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am seeing some of my colleagues use the following workaround for importing external python modules (without installing them).
import sys
sys.path.append(<PATH_TO_MODULE>)
import <module>
sys.path.remove(<PATH_TO_MODULE>)
I don't think this is a good approach but "it works".
What should I suggest them to do instead of the following code and why?
Thanks!
It sounds as though your colleagues are not making virtual environments to run python and are trying to avoid muddy-ing the main python modules.
So I'd suggest they start seperating out their concerns and projects into seperate virtual environments where they don't need to worry about having modules installed.
See also conda environments and other alternatives to achieve the same goal
An alternative approach would be to append the module’s path to PYTHONPATH:
export PYTHONPATH="${PYTHONPATH}:/path/to/your/module/"
In this way, nothing is hardcoded in your source code and whenever something changes, you just need to export the new path to PYTHONPATH.

installing pygame in python, but untill now doesnt work [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I try to install pygame. But untill now doesnt work.
If i go to: http://localhost:17714/
I see this:
And if I try to install pygame like this:
I also went to:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
And I added the .whl file to this directory:
So what I am doing wrong??
Thank you!! Will be nice if somebody can help me.
But I am working on windows 10 - 64bit version
I get this error:
Oke, I could upgrade. But I still get the error:
wowwwwww:
I installed: a other version. And boemmm it works. See:
Try this website:
https://www.webucator.com/blog/2015/03/installing-the-windows-64-bit-version-of-pygame/
I had a look at the comments and it looks like a majority got it to work

Is mysql.connector supported in Python Anywhere? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Im new to pythonanywhere yet I have made my webapp run on their server. My website domain is http://knowfahad.pythonanywhere.com/.
The problem is that I used mysql.connector for database stuff and whenever the databse is being accessed on the website, the error 500 is shown.
My question is whether mysql.connector is supported by python anywhere?
Yes MySQL is supported. If python 2.x, you need to use import MySQLdb
And if you're using MySQL with Python 3, you need to install a module. If you're not using a virtualenv, run:
$ pip3.4 install --user mysqlclient
https://help.pythonanywhere.com/pages/UsingMySQL/

Categories