I am not sure if this is because I work in my company and there is a proxy, I cannot set the environment variable. So, I cannot use pip install in CMD. I try to download the package, to my local machine, and install it using the method from Installing python module within code . But I failed. Here is my code:
import pip
pip.main(['install','h://feng.officeworks/mixed/myPython/numpy-1.12.0'])
This does not work for me, I have the following information:
Invalid requirement: 'h://feng.officeworks/mixed/myPython/numpy'
Traceback (most recent call last):
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\packaging\requirements.py", line 92, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1617, in parseString
raise exc
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1607, in parseString
loc, tokens = self._parse( instring, 0 )
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1379, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\pyparsing.py", line 3376, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1383, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\pyparsing.py", line 3164, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 1), (line:1, col:2)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\req\req_install.py", line 82, in __init__
req = Requirement(req)
File "C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pip\_vendor\packaging\requirements.py", line 96, in __init__
requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'://feng.'"
1
I am using windows 10, Python 3.6.0, Pycharm 2016.3.2. pip is already installed with Python
Also, because I do not have access to environment variable, I cannot set the path to Python. So I cannot use the orders like python or pip in a window terminal. So I need to use a function in python console.
Thanks a lot for the answers. I also tried to go to C:\Users\fchen4\AppData\Local\Programs\Python\Python36-32\Scripts, then use
pip install h://mypath/numpy.
I already unpack numpy here. It does not work. The information shown in PowerShell is like:
Obtaining file:///H:/feng.officeworks/mixed/myPython/numpy
Installing collected packages: numpy
Running setup.py develop for numpy
Complete output from command c:\users\fchen4\appdata\local\programs\python\python36-32\python.exe -c "import setuptools, tokenize;__file__='H:\\feng.officeworks\\mixed\\m
yPython\\numpy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps:
blas_opt_info:
blas_mkl_info:
libraries mkl_rt not found in ['c:\\users\\fchen4\\appdata\\local\\programs\\python\\python36-32\\lib', 'C:\\', 'c:\\users\\fchen4\\appdata\\local\\programs\\python\\py
thon36-32\\libs']
NOT AVAILABLE
.... (There are too much here so I ignore it.)
....
Command "c:\users\fchen4\appdata\local\programs\python\python36-32\python.exe -c "import setuptools, tokenize;__file__='H:\\feng.officeworks\\mixed\\myPython\\numpy\\setup.py
';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 1
in H:\feng.officeworks\mixed\myPython\numpy\
Anyone could please tell me how to install a local package using pip or anything else in python console?