abi
abi

Reputation: 295

Unable to install python modules

I am completely new to python, and am unable to install python modules using pip install, and from ____ import _____.

I want to use BeautifulSoup, and I have the tar.gz file in my directory: C:\Python27\Lib

I don't have administrator's access to my laptop, but I can get someone who has it. Would this be a problem from installing modules? I'm actually not sure if this is where it should be, or how to proceed from here. Would appreciate any help very much, because I can't even get started. Thank you.

Upvotes: 0

Views: 231

Answers (3)

Axel Joel Rizzo
Axel Joel Rizzo

Reputation: 1

Since it could be difficult for you to access admin privileges all the time, I would try to either gain those privileges or installing a virtual environment and setting it up a virtual environment via venv. If you work in Linux/debian, while you have admin privs you have to install the package using:

sudo apt install python3-venv

Then, you use it writing:

python3 -m venv .venv

That sets up and environment which you HAVE to activate using:

source .venv/bin/activate

That modifies the PATH directory to your environment, where you can install your stuff. Creating a separate environment also helps reducing packages conflict since each time you create one it creates an environment with only the dependencies you need, so you can use this again to create separate environments for your projects.

You can leave this environment anytime via the input:

deactivate

You have to activate it again yo access you dependencies, just know the path.

Some IDEs such as Pycharm create venvs automatically if allowed, which makes for less of a hassle when trying to just get to work. You could also try that.

Hope it helps!

Upvotes: 0

Swastik Padhi
Swastik Padhi

Reputation: 1909

Open command prompt and paste the following (for your scenario specifically)-

C:\Python27\Scripts\pip.exe install C:\Python27\Lib\beautifulsoup4-4.3.2.tar.gz

Note: Replace the package name if you have a different version.

Upvotes: 1

Adolfo Correa
Adolfo Correa

Reputation: 823

The easiest way is writting: pip install beautifulsoup on the cmd or powershell

Another way:

  1. Extract the file *.tar.gz

  2. open the folder of the extractor on cmd

  3. execute python setup.py install

Upvotes: 1

Related Questions